GoConqr has a new look! Let us know what you think.

Mind map

HW1

Takarada RikkAA English

Map content

HW1

  1. Q1: How does the random.randint(_,_) work?

    • it will call the function randit in "random" and generate an int between the assigned range
  2. 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
  3. 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
  4. 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
  5. 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
  6. Q6: Is this variable (largest) global or local? Why?

    • the variable (largest) is a local variable since it is declared in the function
  7. Q7: What does None mean?

    • None means that this variable is assigned to null, in a special data type: Nonetype
  8. 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.
  9. Q9: What does return do?

    • Return will sent the information or value to the place calls the function and end the function
  10. 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
  11. 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)

Information

Description
Mind Map on HW1, created by Takarada RikkAA on 03/09/2021.
Created by
Takarada RikkAA
Views
1
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?