« All Events
7PM Python Level 1
October 19, 2018 @ 7:00 pm - 8:00 pm
- Python Level 1, 1st Quiz.
- Homeworks
- Create a new python file call it “HomeworkOct19.py”
- Inside the file, create a for loop which will print number from 4 to 20. Review at “Loopy Loops” chapter to get some guidance (P.32 to P.35)
- Inside the file, create a WHILE LOOP which will keep on asking the user, “Are you hungry?” If the answer is ‘y’, print ‘Here is a burger’ and ask ‘Are you hungry again?’ . if the answer is ‘maybe’, print ‘Make up your mind!!’ and ask ‘Are you hungry again?’ . If the answer is anything else, print ‘bye bye’ and quit from the loop. Review at “Loopy Loops” chapter to get some guidance (P.32 to P.35)
- Create a function, no parameter, which will return a random number between 1 to 8. Review “Password Picker” chapter from page 52 to 56 to see how to produce a random number.
- Create a function which take one parameter and will behave like the following:
- If number 1 is passed to the function, it will return “It is certain.”
- If number 2 is passed to the function, it will return “Most likely.”
- If number 3 is passed to the function, it will return “Signs point to yes.”
- If number 4 is passed to the function, it will return “Most likely.”
- If number 5 is passed to the function, it will return “Ask again later.”
- If number 6 is passed to the function, it will return “Concentrate and ask again.”
- If number 7 is passed to the function, it will return “Outlook not so good.”
- If number 84 is passed to the function, it will return “My reply is no.”