# filename:python2.27.py
# author:super
# date:2018-2-27
def hello_to_others(names):
for i in names:
print('hello, ' + i)
namelist = ['aa', 'bb', 'cc']
hello_to_others(namelist)
# 用来处理两个列表a内容处理完然后放到b列表上的方法,用一个变量去接.pop(), 用append加在新的列表上
lista = ['aa', 'bb', 'cc']
listb = []
while lista:
currentlist = lista.pop()
print(currentlist+' pop')
listb.append(currentlist)
print(lista)
print(listb)
def make_pizza(*toppings):
print(toppings)
def make_info(fisrtname, lastname, **userinfo):
profile={}
profile['firstname'] = fisrtname
profile['lastname'] = lastname
for key, value in userinfo.items():
profile[key] = value
return profile
# 用*加上变量名就是不用确定传入参数的具体个数
make_pizza('aa')
make_pizza('aa', 'cc', 'bb')
# 用**表示可以传入一个字典, 可以接受键值对
userinfo = make_info('super', 'su', age=51, year='1993')
print(userinfo)