Mindmap
Assignment 1 Questions
Inhalt der Mindmap
Assignment 1 Questions
Q1 random.randint(_,_)
- Calling the method random.randint(_,_) returns an integer within a specified range.
- EXAMPLE: random.randint(7,15) will return a number within the range 7 and 15.
- random.randit(integer starting position, integer ending position)
- Calling the method random.randint(_,_) returns an integer within a specified range.
Q2 What is random?
- What is the purpose of using the period before randint?
- Designates that randint is a method within the random module in the Python Standard Library
- The period sometimes relates to dot notation with objects
- Random is a module that offers different methods related to pseudo-random number generators.
- What is the purpose of using the period before randint?
Q3 print(_)
- creates an output: the message within the () and makes it visible on the user's screen when ran
- If the message is any other object than a string, then it will be converted into a strong before being printed
- creates an output: the message within the () and makes it visible on the user's screen when ran
Q4 The (+) Operator
- serves to concatenate different parameters within the print() function into one to-be-printed string
- In the next line of code specifically, the (+) operator connects the different string objects (formed from the randomly generated integers) into one string
- serves to concatenate different parameters within the print() function into one to-be-printed string
Q5 The str(_) function
- transforms an object or value into a string
- In the next line of code specifically, the str(_) function transforms a randomly generated integer into a string
- transforms an object or value into a string
Q6 Variable Largest (global or local?)
- local since the variable is declared within the method getLargestRandom()
Q7 None
- equivalent to null, no value
- None is not equal to 0 and should be considered it's own individual DataType
Q8 inputValue
- given to the function as an argument
- When the user calls countGreaterEqualNumbers,an input value is passed along that can be used within the function
- NECESSARY since the function uses this inputValue to make decisions and return a value
Q9 Return
- gives a value back when a function is called
- return will give the value for smallestOdd when the function getSmallestOddRandom() is called
Q10 Differences between declaring, defining,and calling a function
- DECLARING
- lists the function's name, return type, and parameters
- lists the function's name, return type, and parameters
- DEFINING
- forms the actual body of it, meaning all the code inside is written
- Often you declare and define a function at the same time, though they differ since you can declare a function without defining it
- forms the actual body of it, meaning all the code inside is written
- CALLING
- only requires the function to have a name and specify the parameters to be used
- DECLARING
Q11 Variable Message
- built by calling different functions concatenating their return values using the (+) operator
- The message variable adds more to itself and uses an escape character '\n' to create a new line
Informationen
- Beschreibung
- Mindmap am Assignment 1 Questions, erstellt von Liz King am 25/01/2021.
- Erstellt von
- Liz King
- Aufrufe
- 0
- Bewertung