Lesson 7

blue and white striped round textile
blue and white striped round textile

Learning Goal: Students will be able to use random numbers, string concatenation, and type casting to add unpredictability to their programs.

Learning Objectives
Students will know how to:

  • Generate a random number within a certain range and store it in a variable

  • Display the value of a variable

  • Use str() to cast an integer/integer variable to a string so it can be concatenated with other strings

  • Use + as a math operator to add two integer variables

Today I will…

  • generate random dice rolls that generate a random number within a certain range

  • use a variable to store a random number that the program generates so the value can be used later in the program

  • use a text display tool to display a variable whose value changes each time your program runs.