0
0 Комментариев
def build_person(first_name, last_name):
    person = {'first': first_name, 'last': last_name}
    if age:
        person['age'] = age
        return person
musician = build_person('jimo', 'hendrix', age =27)
print(musician)

Traceback (most recent call last):
File «C:/Users/User/Desktop/python_work/Глава_4/studying_4.py», line 6, in <module>
musician = build_person(‘jimo’, ‘hendrix’, age =27)
TypeError: build_person() got an unexpected keyword argument ‘age’

Traceback (most recent call last):
File «C:/Users/User/Desktop/python_work/Глава_4/studying_4.py», line 6, in <module>
musician = build_person(‘jimo’, ‘hendrix’, age =27)
TypeError: build_person() got an unexpected keyword argument ‘age’

I am studying a book and there is an example and it doesn’t work on my pc, using windows, python 3.8.2 and pyCharm

Why is there an error and how can I fix it?


Добавить комментарий