0

default arguement ?

I keep getting an error for this code def greet (name, age= 29): print('hello' + name +' , I am' + age) greet ('max')

28th May 2020, 10:02 PM
Jah Revelo
Jah Revelo - avatar
2 odpowiedzi
+ 7
Works fine def greet (name, age= 29): print('hello ' + name +' , I am', age) greet ('max') Since you were adding "am"(string)+age(int) it was giving a Typeerror
28th May 2020, 10:09 PM
Abhay
Abhay - avatar
+ 3
def greet (name, age= 29): print('hello' + ' I am' + str(age)) greet ('max')
28th May 2020, 10:09 PM
ABHISHEK
ABHISHEK - avatar