Compsciskillsaudit.files.wordpress.com



# My fortune tellerimport random #imports a module that randomly selects a fortuneimport time #imports a module that will mean you can get the program to wait a few seconds before it tells you the fortuneprint ("Welcome to my fortune teller") #prints a stringquestion = input ("Would you like me to tell your fortune?\n") #uses a variable that allows for user inputcolour = input("Think of a colour\n")print ("I will now select a fortune based on your selection of ", colour) #prints a string and allows you to input the colour variabletime.sleep(2) #makes the program wait while a few seconds while it generates your fortunefortunes = [ "You will go on a date with Harry Styles", "You have a secret admirer", "You will be a top Python Programmer", "You are one directions number one fan"]# a list with fortunes in for the random module to pick fromprint(random.choice(fortunes))# tells the program to pick a random fortune from the fortune list. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download