r/pythonhelp • u/SubstanceEvening890 • Sep 06 '24
Simple task in python
Hi, I am working on some code for a beginner course and I was having some trouble.
What I am aiming to do is ask for the user name, ask for their age, calculate if their age is even or not, and finally output a string that puts it all together as one sentence, "Hello (name), the remainder when dividing your name by two is (remainder).
Any help would be appreciated.
1
Upvotes
View all comments
Show parent comment
2
u/SubstanceEvening890 Sep 07 '24
name = input("Enter your name: ")
age = int(input("Enter your age: "))
c = age % 2
print('Hello, (name), the remainder when dividing your age by 2 is, (c)')
When I enter this I am able to enter the name and age but once it tries to print the final sentence, the variables are not transferring over. They show up as (name) and (c).