python学习日记

3-1姓名 print(name[].title())

name = [‘wangwei’,’weiguomeng’,’nidaye’]
print(name[0].title())
print(name[1].upper())
print(name[2].lower())

3-2问候语

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())

3-3自己的列表

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())

3-4嘉宾名单

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!”)

3-5修改嘉宾名单

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!”)

3-6添加嘉宾

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!”)

3-7缩减名单

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()弹出元素时,没注意到上一行缺少个 )。导致文本器一直在提示无效语法。

自己要注意细心,加油!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值