Mindmap
CIS4930 Assignment #1
Inhalt der Mindmap
CIS4930 Assignment #1
Global Variables
- Q1: How does the random.randint(_,_) work?
- The random.randint(_,_) generates a random number between two integer values that are specified between the brackets.
- When specifying the two bounds for the random integer, the upper and lower limits are included.
- Q2: What is "random" and what is the purpose of using the period (.) before randint?
- "Random" means that the number returned will not follow a pattern or be dependent on another number. Each number in the range will have the same probability of being chosen.
- The purpose of using the period before randint is so that Python knows that the method is from the random module.
- Q3: What does the function print(_) do in the next line of code?
- Print() prints the message into the PyCharm console, dependent on the values of the random numbers.
- Q4: What is the purpose of the (+) operator in the next line of code?
- The purpose of the (+) operator is to add an object into the string.
- In this case, the (+) operator is used to add in the random number values as well as to add spaces in between them.
- Q5: What is the purpose of the function str(_) in the next line of code?
- The purpose of the function str(_) is to convert the random integers to type string.
- Q1: How does the random.randint(_,_) work?
Functions' declaration and definition
- Q6: Is this variable (largest) global or local? Why?
- The variable largest is local because it is defined within the function and cannot be accessed outside the function.
- Q7: What does None mean?
- None is used to indicate that a variable has no defined value.
- Q8: What is inputValue? Why is it necessary for this function?
- inputValue is the argument for the function.
- It is necessary for the function because we need to define a value that we can compare the random numbers to in order to see which numbers are greater than and equal to the inputValue.
- Q9: What does return do?
- Return gives a value and a type to the object returned by the function.
- It also stops the execution of the function.
- Q6: Is this variable (largest) global or local? Why?
Function calls
- Q10: What is the difference between declaring, defining, and calling a function?
- Declaring a function involves providing information about the properties of the function, such as the arguments it takes.
- Defining a function involves telling Python how to execute the function given the arguments you have provided.
- Calling a function is completed by typing the function name followed by parentheses and the parameters involved in the function.
- Q11: How was the variable message built?
- The variable message was built by combining multiple strings.
- Q10: What is the difference between declaring, defining, and calling a function?
Informationen
- Beschreibung
- Mindmap am CIS4930 Assignment #1, erstellt von Sara Loving am 17/01/2021.
- Erstellt von
- Sara Loving
- Aufrufe
- 0
- Bewertung