赞
踩
def great_user():
“”“显示简单的问候语”""
print(“Hello!”)
great_user()
print()
def great_user(username):
“”“显示简单的问候语”""
print("Hello, " + username.title() + “!”)
great_user(‘jessie’)
def describe_pet(animal_type, pet_name):
“”“显示宠物信息1"”"
print("\nI have a " + animal_type + “.”)
print("My " + animal_type + "'s name is " + pet_name.title() + “.”)
describe_pet(‘hamster’, ‘harry’)
def describe_pet(animal_type, pet_name):
“”“显示宠物信息2"”"
print("\nI have a " + animal_type + “.”)
print("My " + animal_type + "'s name is " + pet_name.title() + “.”)
describe_pet(‘hamster’, ‘harry’)
describe_pet(‘dog’, ‘willie’)
def describe_pet(animal_type, pet_name):
“”“显示宠物信息3"”"
print("\nI have a " + animal_type + “.”)
print("My " + animal_type + "'s name is " + pet_name.title() + “.”)
describe_pet(animal_type = ‘hamster’, pet_name = ‘harry’)
def describe_pet(pet_name, animal_type=‘dog’): # 注意这里修改了形参顺序
“”“显示宠物信息4"”"
print("\nI have a " + animal_type + “.”)
print("My " + animal_type + "'s name is " + pet_name.title() + “.”)
describe_pet(pet_name = ‘willie’) # 也可直接用describe_pet(‘willie’)
def describe_pet(pet_name, animal_type=‘dog’):
“”“显示宠物信息5"”"
print("\nI have a " + animal_type + “.”)
print("My " + animal_type + "'s name is " + pet_name.title() + “.”)
describe_pet(pet_name = ‘harry’, animal_type = ‘hamster’)
print()
def get_formatted_name(first_name, last_name):
“”“返回整洁的姓
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。