CMSC 201 |
Lab 2: A Simple ProgramInputWhat is it? User input is a way to get information from the user (you!) after you've finished writing your program. It would be impossible to always know the exact data you'll need when you're writing your code. How do I get it? In Python user input looks like this: name = input("Enter your name please: ") When you run the finished program it will display something like this Enter your name please: Casting: In Python anything entered by the user is automatically turned into a string, but what if you need an int? age = int(input("Enter your age please")) |