Lesson 7


So far we have worked on using variables and inputs and printing things. Now we are moving on again onto something rather fun. Random! We will be learning how to use the random function and how to import things and lists.

In the code above somethings have changed from what we were doing previously. Such as you may have noticed we have imported something. We have imported a Python library (basically a list of extra stuff) that requires no additional downloads. Next you may notice the list. It is a group of numbers or words or letters which can be used for many things. In the above example it is used to make a random choice from that list. Next we have choice = random.choice(list_1). Then print choice which prints the random number form the list.