Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
Ask for the user's age and show how old they will be in ten years.
int(input(...)) asks and converts in one step.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, compare your working with the solution.
Plan. The age must become a number before we add to it.
age = int(input("How old are you? "))print("In ten years you will be", age + 10)Check. If the user types 12, the program shows In ten years you will be 22.
Log in to join the discussion.
Loading…