--Originally published at COMPU 01
The next thing I learned at python was saving some information.
In the code I made, the idea was to ask the user for his/her name and type it in. Something like this…
name = input(“Enter your name: “)
After the user clicked Enter, a message would appear on the screen, so I did kind of the same work from my last code but I added the option of showing the name of the user by just adding a “+” and the name of my variable…
print(“Welcome ” +name)
Next thing, I made another input to ask the age of the user, almost like the first one, but this one instead needs to be an int and no a String ’cause we are saving a number, not a text.
age = int(input(“Enter your age: “))
Now the program will take this information and will decide to either show a message or not, by using an if and elif (else if) command.
if age >= 18:
print(“Congratulations ” +name +” you are an adult”)
elif:
print(“You are still fresh ” +name)
IT IS VERY IMPORTANT TO USE “TAB” IN ORDER TO GIVE THE INSTRUCTIONS!!!