Intro to Input Strings: Python Boredom Buster!
by AnRobot in Circuits > Computers
87 Views, 0 Favorites, 0 Comments
Intro to Input Strings: Python Boredom Buster!
This is an input string code, and is a great way to introduce yourselves to the input function in Python as it is a simple and basic code to build off of. Enjoy!
Supplies
Have access to Python IDLE shell(3.8, 64 bit) as the default mode for coding with python.
Create a New File
Once on IDLE shell, open and save a new File
Store Input in Variable
Store the user input in a variable, in this case I used "Q" to store the input.
Create If-else Conditional Statements and More Inputs!
In order to determine the possible answers given by the user, create an if-else conditional statement to perform the intended action.
In this case, if the user says "Yes" to hearing a joke, the code will move ahead with asking the joke(a second input variable is needed). If the answer to the joke is correct, the code will print "Correct". However, if the answer is wrong, the code will print "No, Silly!"
Yet, if the user did NOT say "Yes" to hearing a joke, the code will print "Okay, No Problem" and end.