赞
踩
name = [‘wangwei’,’weiguomeng’,’nidaye’]
print(name[0].title())
print(name[1].upper())
print(name[2].lower())
print(“I’m very glad to meet you.”+name[0].title())
print(“I’m very glad to meet you.”+name[1].title())
print(“I’m very glad to meet you.”+name[2].title())
food = [‘malatang’,’hongshaorou’,’latiao’]
print(“\nMy favorite food is”+food[0].lower())
print(“\nMy favorite food is”+food[1].lower())
print(“\nMy favorite food is”+food[2].lower())
print(“\n”+name[0].title()+” I invite you to dinner with me!”)
print(“\n”+name[1].title()+” I invite you to dinner with me!”)
print(“\n”+name[2].title()+” I invite you to dinner with me!”)
print(“\nI sorry,”+ name[0]+” can’t with me to dinner.”)
name[0] = ‘wangweiwei’
print(“\n”+name[0].title()+” I invite you to dinner with me!”)
print(“\n”+name[1].title()+” I invite you to dinner with me!”)
print(“\n”+name[2].title()+” I invite you to dinner with me!”)
print(“The good news, I found a bigger table!”)
name.insert(0,’xiaoxingyun’)
name.insert(2,’xiaodaomei’)
name.append(‘kelianwa’)
print(“\n”+name[0].title()+” I invite you to dinner with me!”)
print(“\n”+name[1].title()+” I invite you to dinner with me!”)
print(“\n”+name[2].title()+” I invite you to dinner with me!”)
print(“\n”+name[3].title()+” I invite you to dinner with me!”)
print(“\n”+name[4].title()+” I invite you to dinner with me!”)
print(“\n”+name[5].title()+” I invite you to dinner with me!”)
print(“because not timely sent to the table, so I can only invited two guests to dinner.”)
print(name)
name_1 = name.pop(0)
print(name_1+” I’m sorry can’t invite you to dinner!”)
name_1 = name.pop(0)
print(name_1+” I’m sorry can’t invite you to dinner!”)
name_1 = name.pop(0)
print(name_1+” I’m sorry can’t invite you to dinner!”)
name_1 =’weiguomeng’
name.remove(name_1)
print(name_1+” I’m sorry can’t invite you to dinner!”)
print(name)
print(name[0]+” I invite you to dinner.”)
print(name[1]+” I invite you to dinner.”)
del name[0]
del name[0]
print(name)
总结今天学习过程中出现的问题。
1.print里的变量message打错了。
2.添加元素使用instert()时语法错误,没有加 ‘。导致python解读不了。
3.使用pop()弹出元素时,没注意到上一行缺少个 )。导致文本器一直在提示无效语法。
自己要注意细心,加油!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。