我正在学习python以提高自己的技能。我正在构建一个Web应用程序,以跟踪与我一起工作的自由职业者。我正在学习一个教程,但自己编写。
这是代码:
freelancers = ["juan", "andre"] #original list
def get_freelancer_titlecase(): # makes freelancers TitleCased
freelancers_in_titlecase = []#empty dict
for freelancer in freelancers:
freelancers_in_titlecase = freelancer.title()
return freelancers_in_titlecase
def print_freelancers_in_titlecase():#print freelancers in TitleCase
print_freelancers_in_titlecase = get_freelancer_titlecase()
print(print_freelancers_in_titlecase)
freelancer_list = get_freelancer_titlecase() # Place the function inside a variable
print(freelancer_list)# here is my problem, this returns only the first entry "Juan", in title case but stops there.
print(freelancers)# this is a check to see the items on the list and they are ["juan", "andre"]
为什么print(freelancer_list)只退货一件?我需要能够调用列表,并让所有自由职业者拥有大写字母。后来,它应该是一本字典,其中也要保留一个ID,当然还要包含每个自由职业者的输入。
这是我的第一个问题,所以先谢谢您。
ibeautiful
拉丁的传说
白板的微信
相关分类