Python萌新自学日记1

写日记的目的

作为一个刚刚开始自学的萌新,为了督促自己的学习,我决定开始更新每一天(或者是几天)的python学习状态,让我自己明白自己每天学了什么,每天的日记可能涉及到当天的学习的笔记、知识点、问题,如果有大佬发现了我的错误或者是误区,希望能留言评论告诉我(前提是有人发现这篇文章

今天的日记

目前学习进度为《Python编程从入门到实践》的第三章

补上第二章感觉自己会忘的笔记

对于字符串大小写的修改
.title()
使用制表符或换行符来添加空白
\t \n

第三章

3-4

#3-4
list_name = ['dad', 'mum', 'sister']
print('dear '.title() + list_name[0].title() + ' thank for your coming')
print('dear '.title() + list_name[1].title() + ' thank for your coming')
print('dear '.title() + list_name[2].title() + ' thank for your coming')
print('wow! '.title() + list_name[2].title() + ' can not come')
#3-5
list_name[2] = 'bob'
print('dear '.title() + list_name[0].title() + ' thank for your coming')
print('dear '.title() + list_name[1].title() + ' thank for your coming')
print('dear '.title() + list_name[2].title() + ' thank for your coming')
#3-6
print('i think i find a bigger table , we can invite more people!'.title())
list_name.insert(0, 'giogio')
list_name.insert(1, 'nanne')
list_name.append('jojo')
print('dear '.title() + list_name[0].title() + ' thank for your coming')
print('dear '.title() + list_name[1].title() + ' thank for your coming')
print('dear '.title() + list_name[2].title() + ' thank for your coming')
print('dear '.title() + list_name[3].title() + ' thank for your coming')
print('dear '.title() + list_name[4].title() + ' thank for your coming')
print('dear '.title() + list_name[5].title() + ' thank for your coming')
#3-7
print('I am sorry , something happened so i can only invite two people')
print(list_name)
one = list_name.pop(0)
print('I am sorry Giogio, dinner can not be held tonight')
two = list_name.pop(0)
print('I am sorry Nanne, dinner can not be held tonight')
three = list_name.pop(3)
print('I am sorry Jojo, dinner can not be held tonight')
four = list_name.pop(2)
print('I am sorry Bob, dinner can not be held tonight')
print('dear '.title() + list_name[0].title() + ' thank for your coming')
print('dear '.title() + list_name[1].title() + ' thank for your coming')
del list_name[0]
del list_name[0]
print('Now the list is empty , right?')

今日小结

其实上面这串代码还不是第三章的全部,还有后面一个练习,但是由于时间关系(),后一个练习明天再更新,今天这一个练习里的代码打了我快一个小时,原因是发现各种各样的问题,比如pop弹出元素发现弹错了,只能一行一行print去检验;del删错了,也只能一行一行的print检验;以及一开始我是打算print出来中文信息的,后来发现中文好像显示不出来,于是用起了我的蹩脚英文。

good good study day day up

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值