I'm trying to learn Python based on Python Crash Course by 2nd edition by Eric Matthes.
I tried this excersice working with kwargs in pycharm. Pycharm greys out my **extra parameter. Why ?
def cars(manufacturer, modelname, **extra):
auto_info['fabriekant'] = manufacturer
auto_info['model'] = modelname
return auto_info
autoprofiel = cars('Volvo', 'xv40', color='black', cruize_control=True)
print(autoprofiel)
- It looks exactly the same like the sample code to me.
def build_profile(first, last, **user_info):
'Build a dictionary containing everything we know about a user.'
user_info['first_name'] = first
user_info['last_name'] = last
return user_info
user_profile = build_profile('Albert','einstein',location='princeton',field='physics')
print(user_profile)