0
Who can tell me what's the mistake in the below code please?
#The following are my details name, age, carreer = "Muhammad Mustafa Ibrahim","Seventeen year old","Programmer" print (name) print (age) print (carreer ) def myfunc(): Age = 7*2 print (Age) myfunc()
5 Respostas
+ 4
The variable Age is only defined inside the myfunc() function. Outside of it, it is undefined. That and you tried to print Age before even calling the function that creates it, although this part is inconsequential as my former point is the main problem.
0
Try adding a space in bettwen the strings.
0
and online 9 you don’t assign the variable Age (with a capital)
0
python is case sensative. the variables age and Age are two different variables for python. and since they are different, the “Age” variable only exists in the function as a local variable. you will have to call the global age variable tochange the value in the function.