Is there a way for me to take an input, and use it in a mathematical question, and print the answer? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 11

Is there a way for me to take an input, and use it in a mathematical question, and print the answer?

https://code.sololearn.com/c5UOjeJYZ8Gz/?ref=app

2nd May 2017, 8:38 AM
David Gedalia Ordman
David Gedalia Ordman - avatar
4 Respostas
+ 7
modified your code a bit # import datetime to get current date import datetime # get current time now = datetime.datetime.now() # get user age and convert to int (for substraction) x=int(input('What is your age?')) # substract age from current year print ("\nAwesome! you were born in ", now.year-x)
2nd May 2017, 8:46 AM
Burey
Burey - avatar
+ 7
thanks a lot
2nd May 2017, 9:00 AM
David Gedalia Ordman
David Gedalia Ordman - avatar
+ 7
can you check it? its called: birth date discoverer
2nd May 2017, 9:07 AM
David Gedalia Ordman
David Gedalia Ordman - avatar
+ 5
sure thing
2nd May 2017, 9:06 AM
Burey
Burey - avatar