Programming with Python: Intro to Variables, Data Types, and Input


Talking to Your Computer

Hello! Now that we know some of the basics of printing, it’s time to learn a little bit about variables and then use that knowledge to make a program that handles user input. At the end of the post, we’ll have a program that takes user input and uses it to solve a math problem (exciting!). First, we’ll type in some code in the Eclipse editor and then we’ll go over what each part of the code means.

print("Hello there! What's your name?" )
user_input = input ("Enter your name : ")
print("Howdy ", user_input , "!")

Run the code in Eclipse, then click inside the console at the bottom, type in your name, and press Enter. If you copied the code exactly as above, you should see this:

Except with your name instead of mine. Unless your name's Brooklyn. That's cool too Except with your name instead of mine. Unless your name’s Brooklyn. That’s cool too

Now, let’s go through the code above…

View original post 986 more words