- This event has passed.
6:30pm – Intro to Python – Roland
May 21 @ 6:30 pm - 7:30 pm
Today We Did
- Did practice problems reviewing for the quiz
- Error fixing
- https://www.ayclogic.com/fix-python-bugs-2/
- Practice quiz questions (1-3)
- https://www.ayclogic.com/intro-to-python-exercises-for-quiz-2/
- Error fixing
Homework:
Make a new file called May21_QuizPracticeHW and complete question 4 found at https://www.ayclogic.com/intro-to-python/star-wars-problem/ (also pasted below)
- Create a function with return value, “movie_ticket_price”. The function need to have one parameter “age“. Inside the function, when age is less than 4, return 0. When age is less than 10 return 5. When age is less than 59 return 10. Otherwise return 7. Outside the function, ask user in the shell “How old are you: ” take user input and call the above function and use the user input as the function parameter. Print the function return value like this “Your ticket price is $<return value>”. Look at expected output below if you run your program 3 times with different input.
How old are you: 7 Your ticket price is $5 How old are you: 3 Your ticket price is $0 How old are you: 100 Your ticket price is $7
Study for the second exam next week!!! You will have the entire class time to take the exam. The following are the topics:
- Functions
- With return values
- Without return values
- Parameters
- Random module
- import random
- random.choice
- random.randint
- Python errors
- What they mean and how to fix them!!!
- Everything else from Quiz 1 and before should be mastered and is also fair game
- I recommend looking over your past notes and practicing with past homeworks! The practice questions we did are good review as well! Practice doing them on your own and compare with the solutions in the notes!
If you have any questions, feel free to email me at rolandyang@ayclogic.com