python学习
文章平均质量分 83
戴戴0204
这个作者很懒,什么都没留下…
展开
-
python变量和简单数据类型
#coding=utf-8#python之禅import this#打印变量massage="hello world python"print(massage)#打印修改后的变量massage="hello world python!"print(massage)#改变字符大小写name="abc sjijwi"print(name.title())print(name.upper())print...原创 2018-05-17 14:51:06 · 412 阅读 · 0 评论 -
python列表学习
#coding=utf-8#列表打印subjects=['math','English','physical','art']print(subjects)#打印列表中的一个元素print(subjects[0])print(subjects[0].title())#打印列表中的最后一个元素print(subjects[-1])#使用列表的元素massage="my favorite subject...原创 2018-05-17 14:51:55 · 355 阅读 · 0 评论 -
python学习字典
#一个简单的字典student_0={'c_no':'3117370057','sex':'female','name':'daimengyao'}#访问并打印字典中的值print(student_0['c_no'])#添加键值对student_0['course']='math'student_0['score']='90'print(student_0)#修改字典中的值student_0['s...原创 2018-05-17 14:50:30 · 817 阅读 · 0 评论 -
python之if语句
#if语句subjects=['math','English','physical','art','english']for subject in subjects: if subject=='English': print("We must learn well:") print(subject) elif subject=='art': print("I can not learn it...原创 2018-05-17 14:51:44 · 254 阅读 · 0 评论 -
python操作列表
#coding=utf-8#for循环遍历整个列表subjects=['math','English','physical','art']for subject in subjects: print(subject)#在for循环中、后的更多操作subjects=['math','English','physical','art']for subject in subjects: print("I...原创 2018-05-17 14:51:16 · 853 阅读 · 0 评论 -
python学习input函数
#函数inputmessage = input("Tell me something, and I will repeat it back to you: ")print(message)message1 = input()print(message1)#创建多行字符串的方式prompt1="type someting"prompt2=prompt1+": "+input()print(promp...原创 2018-05-17 14:50:12 · 16342 阅读 · 0 评论 -
python学习while循环
#while循环#输出1-5的数n=1while n<=5: print(n) n=n+1#循环停止条件message1="\nTell me something,I will repeat you ."message2="\nEnter 'quit' to end the program. "message = ""while message != 'quit': message = in...原创 2018-05-17 14:49:53 · 1047 阅读 · 0 评论