Taking user input
Input
EXAMPLE:
input("What's your name?: ")
Variables
What is a variable?
input
asks for something, takes it, but then has nowhere to put it. We can change that with a variable
which is a value that we can use to name and store data. (Remember, David's box for David's phone?)Naming variables
- You can give a variable any name you want, but you can't use spaces.
- You can use:underscores_between_words or
- camelCaseToMakeItEasierToRead
ewe
EXAMPLE:
myName = input("What's you name?: ")
myAge = input("How old are you? :")
print("Gee, that's REALLY OLD")
replit = input("Do you like Replit?")
print("OF COURSE YOU DO!")
Printing a Variable
EXAMPLE:
print("So, you are")
print(myName)
print("and are the ripe old age of")
print(myAge)
print("and clearly think that Replit is")
print(replit)
Comments
Post a Comment