![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
文章平均质量分 76
肥腾君
这个作者很懒,什么都没留下…
展开
-
python编程 从入门到实践第七章 输入与while循环
#char 7 用户输入和while循环 message=input('tell me something, and i will repeat it to you:') print(message) #input接受一个参数,即要向用户显示的提示或者说明,即用户可以看到引号中的内容再进行输入 #输入内容储存再变量中再进行输出 name=input('please enter your name:原创 2017-10-18 16:00:03 · 356 阅读 · 0 评论 -
python编程 从入门到实践 第八章 函数 及课后题
#char 8 函数 #定义函数 #第一类:无参数,无返回值类型 def greet_user(): #greet function print('Hello') greet_user() #第二类:加入了一个参数: def greet_user(username): #another greet function print("Hello "+username.title()+" !"原创 2017-10-20 19:33:15 · 507 阅读 · 0 评论 -
python 编程 入门到实践 第三章 列表部分 (课后题加原书)
#列表,用[]表示列表,并用逗号隔开元素 bicycles=['treck','cannondale','redline','specilized'] print(bicycles) #访问列表元素,根据其索引位置,用括号括起,即是访问该位置的元素,且索引由1开始,以-1结束 print(bicycles[1]) #采用.title()使其输出更标准 print(bicycles[1].title原创 2017-10-12 17:15:45 · 313 阅读 · 0 评论 -
python 编程 入门到实践 第四章 列表操作和元祖 (课后题加原书)
#char 4 操作列表 #4.1 遍历列表 magicians=['alice','david','carolina'] for magician in magicians: print(magician.title()+'was a great trick!') print('i can no wait to see your next trick'+ magician.title()+'原创 2017-10-13 09:41:41 · 690 阅读 · 0 评论 -
python编程 从入门到实践 第五章 条件判断语句
#char 5 if语句 #5.1 结构:if: # sth to do # else: # sth to do cars=['audi','bmw','subaru','toyota'] for car in cars: if car=='bmw': print(car.upper()) else: print(car.title()) #5.2条件测试 #5.2.1 检查原创 2017-10-14 11:00:45 · 409 阅读 · 0 评论 -
python 编程 入门到实践 6章 字典与嵌套
#char 6 alien_0={'color':'green','points':5} #采用键与值相互关联,且一一对应,访问可以直接访问字典中的键即可 print(alien_0['color']) print(alien_0['points']) #6.2使用字典 alien_0={'color':'green','points':5} #可用变量名等于某字典里该键的值,表示对该键的索引 n原创 2017-10-16 09:19:27 · 520 阅读 · 0 评论