Chatbot: Using the Python input function, we created a basic chatbot that responds to what you tell it.
Magic 8 Ball: Using if-else statements, we created a magic 8 ball with 4 responses:
Absolutely
Most Likely
Possibly
In your dreams
The probability distribution of each result is evenly spread.
Practice Exercises: Using the If-Elif-Else Statements we learned in class, we completed various tasks and coded programs that can calculate or categorise specific values based on user input.
I coded a calculator, an age categorisation program, a movie ticket price calculator, and a quadratic root calculator(only applies to real roots)
Practice Exercises 2: We further practiced our If-Elif-Else Statements to create various programs for games and information.
I coded a Day of the Week program, a Weather-Clothing Program, a Number Guessing Game, and a Rock Paper Scissors Game.Â
I already coded the quadratic calculator last class, though I re-edited it to make it more efficient (Updated version posted below).
Day of the Week: This program can tell you the day of the week of a date if you input the amount of days away from Monday it is.
Weather-Clothing Program: Based on the weather outside, this program will tell you the ideal clothing to ensure comfort and safety.
Number Guessing Game: The computer will generate a random number which the user has to guess. If the answer is incorrect, the game will tell the user a hint to guide them in the right direction.
Rock Paper Scissors Game: A simple game of rock-paper-scissors with a computer that randomly generates its answers.
Quadratic Calculator (Updated): This calculator can solve a quadratic equation for its roots given the quadratic coefficient, linear coefficient, and constant. The updated version assigns a value to a variable for the discriminant, to make the program more efficient. The new program also supports decimals.