+ 1

This code is supposed to receive users date of birth and output users current age but it's not working

name= input('what is your name? ') print ('welcome', name) age= input('what year were you born? ') print ('your current age is:') x=2017 def current(x,age): return x-age

13th Sep 2017, 7:57 PM
Joelsays
Joelsays - avatar
1 Answer
+ 10
Two things here: 1. You have to convert age to int if you want to make arithmetic operations on it. 2. You have to actually use the current() method in the print statement. Of course it has to be defined before it's used.
13th Sep 2017, 8:05 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar