3.28python作业

# 8-2
def favorite_book(book_name):
    print("One of my favorite book is "+ book_name)

favorite_book('Sherlock')


# 8-5
def describe_city(city, country = 'China'):
    print(city + " is in " + country)

describe_city('Guangzhou')
describe_city('Shanghai')
describe_city('New York', 'America')


# 8-14
def make_car(producer, xinghao, **other):
    msg = {}
    msg['producer'] = producer
    msg['xinghao'] = xinghao
    for key, value in other.items():
        msg[key] = value
    return msg
car = make_car('subaru', 'outback', color = 'blue', tow_package = True)
print(car)

# 8-15
# import function
# function.fun()

# from function import fun
# fun()

# from function import fun as fn
# fn()

# import function as mn
# mn.fun()

from function import *
fun()

猜你喜欢

转载自blog.csdn.net/control_xu/article/details/79777963