A simple program asking the user questions and using their answers to build up a fortune telling in a list Step one The first line allows us to use the sleep commands to pause our program The report creates a list to store our fake fortune telling ID: 646030
Download Presentation The PPT/PDF document "Creating a mystic meg program" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Creating a mystic meg program
A simple program asking the user questions and using their answers to build up a fortune telling in a listSlide2
Step one
The first line allows us to use the sleep commands to pause our program
The report=[] creates a list to store our fake fortune tellingSlide3
Step 2:getting the users name
The 2
nd
line creates a variable called name which will store whatever the user types into the input boxThe last line ads the name into the list called reportSlide4
Step 3:telling the user their fortune
In the first line we ask a simple question and put the users answer into the variable q1
In the second line we see if the user has put an n inside our variable q1
If they have then we append “you need to avoid cats” to our report list
In the fourth line we see if the user has put a y inside our variable q 1Slide5
Step 4:telling their fortune
this line prints the report list item by item
0 is the users name 1 is the line from if
elif else choice