Mind map
HW1
Map content
HW1
Q1: How does the random.randint(_,_) work?
- it will call the function randit in "random" and generate an int between the assigned range
Q2: What is "random" and what is the purpose of using the period (.) before randint?
- random is a code library and the period before randint specify that randint is a function in random
Q3: What does the function print(_) do in the next line of code?
- it will let the shell print out the string in the bracket
Q4: What is the purpose of the (+) operator in the next line of code?
- it will combine the string and variable between the (+) operator and form a new string
Q5: What is the purpose of the function str(_) in the next line of code?
- the str(_) is to convert the any variable in the bracket to a string variable
Q6: Is this variable (largest) global or local? Why?
- the variable (largest) is a local variable since it is declared in the function
Q7: What does None mean?
- None means that this variable is assigned to null, in a special data type: Nonetype
Q8: What is inputValue? Why is it necessary for this function?
- The inputValue is the argument/parameter. Actually if the randomInput is delare before this function, the inputValue is not necessary. However, in this case, we don't know the value we wang to input, this is necessary.
Q9: What does return do?
- Return will sent the information or value to the place calls the function and end the function
Q10: What is the difference between declaring, defining, and calling a function?
- Declaring: a function is declared as to show the computer that there is a function
- Define: define a function is to define what can this function do
- Calling: calling a function is to ask the computer to use this function at the place calls it
Q11: How was the variable message built?
- Varaible message is combined by 2 things
- assigned strings such as "Our results are:\n"
- Results of the function returns such as str(function3)
- Varaible message is combined by 2 things
Information
- Description
- Mind Map on HW1, created by Takarada RikkAA on 03/09/2021.
- Created by
- Takarada RikkAA
- Views
- 1
- Rating