Mapa mental
Python
Conteúdo do mapa
Python
Q1: random.randint(,) works in that the user sets the range of values in which the computer will pick a random integer in that range (inclusive).
- Q2: "random" is the python function to select a random number in a specified range. The period (.) and randint specifies that the range "random" applies to must be a random integer.
- Q3: print() outputs the string "The numbers generated are: " + str(randomNumberA) +" "+ str(randomNumberB) +" "+str(randomNumberC) +" "+ str(randomNumberD) +" "+ str(randomNumberE), where the "str(randomNumberX)" represents the variable called randomNumberX in string form. If randomNumberA = 2, randomNumberB = -30, randomNumberC = 145, randomNumberD = 1, and randomNumberE = 1666, then the response returned via print() would be as follows: The numbers generated are: 2 -30 145 1 1666
- Q4: The (+) operator combines the specified components into a single response.
- Q5: The str() function makes the variable within the parenthesis () become a string for the purposes of that line of code.
- Q6: The variable "largest" is local as it is defined within the function definition and will not be used outside the function definition. This is used for this function definition as "largest = None" is initializing the variable for later use.
- Q7: None means nothing (i.e. no number/string/value) the variable/criteria listed.
- Q8: InputValue is a placeholder such that when the function countGreaterEqualNumbers() is used, whatever is in the parenthesis () will be specified as InputValue and can be used per the lines of code that use the InputValue variable.
- Q9: The return command outputs the variable/number/string that follows it.
- Q10: Declaring and defining a function are synonymous in their purpose to specify a new function using the command def. A function is called when the function has already been defined and the function name is then listed with a specified argument within the parenthesis.
- Q11: The variable message was defined and changed to finally mean a string of the largest, smallest, count of the greater/equal, existence of smallest odd, and the average numbers.
- Q10: Declaring and defining a function are synonymous in their purpose to specify a new function using the command def. A function is called when the function has already been defined and the function name is then listed with a specified argument within the parenthesis.
- Q9: The return command outputs the variable/number/string that follows it.
- Q8: InputValue is a placeholder such that when the function countGreaterEqualNumbers() is used, whatever is in the parenthesis () will be specified as InputValue and can be used per the lines of code that use the InputValue variable.
- Q7: None means nothing (i.e. no number/string/value) the variable/criteria listed.
- Q6: The variable "largest" is local as it is defined within the function definition and will not be used outside the function definition. This is used for this function definition as "largest = None" is initializing the variable for later use.
- Q5: The str() function makes the variable within the parenthesis () become a string for the purposes of that line of code.
- Q4: The (+) operator combines the specified components into a single response.
- Q3: print() outputs the string "The numbers generated are: " + str(randomNumberA) +" "+ str(randomNumberB) +" "+str(randomNumberC) +" "+ str(randomNumberD) +" "+ str(randomNumberE), where the "str(randomNumberX)" represents the variable called randomNumberX in string form. If randomNumberA = 2, randomNumberB = -30, randomNumberC = 145, randomNumberD = 1, and randomNumberE = 1666, then the response returned via print() would be as follows: The numbers generated are: 2 -30 145 1 1666
- Q2: "random" is the python function to select a random number in a specified range. The period (.) and randint specifies that the range "random" applies to must be a random integer.
Function
Variable
Value
Informações
- Descrição
- Mapa Mental sobre Python, criado por Jackie Golabek em 24-01-2021.
- Criado por
- Jackie Golabek
- Visualizações
- 1
- Avaliação