Answer the question
In order to leave comments, you need to log in
Why does the NameError: name 'age' is not defined error occur?
The code
def user_spisok(name, age):
for names in name:
print("\nHello,"+ name.title())
print("\ How are old you ? ")
for ages in age :
print(" My age" + "is" + age)
spisok ('eva', age=13)
user_spisok(spisok)
for ages in age :
NameError: name 'age' is not defined
Answer the question
In order to leave comments, you need to log in
The code must be wrapped with the appropriate tag in the question. It is not clear where you have indents and so on.
def user_spisok(names, ages):
for i in range(len(names)):
print(f"Это {names[i]}, ей {ages[i]} лет")
names = ['eva']
ages = [12]
user_spisok(names, ages)
Indentation in python is meaningful, separating blocks from each other. Your code is clearly not doing what it was intended to do.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question