python基础第一天

2018-09-18 06:46:08来源:博客园 阅读 ()

新老客户大回馈,云服务器低至5折

# -*- encoding:utf-8 -*-
# print('我爱中国')
  1 # -*- encoding:utf-8 -*-
  2 # print('我爱中国')
  3 '''
  4 x = 1+2+3+4
  5 print(x)
  6 print(x*5)
  7 y = x*5
  8 print(y+100-45+2)
  9 
 10 print('泰哥泰哥,我是小弟')
 11 print('泰哥泰哥,我是三弟小妹')
 12 
 13 
 14 t-t = 2
 15 3t_t = 23
 16 *r = 4
 17 _ = 'fdsa'
 18 ___ = 4
 19 %- = 'fdsa'
 20 2w = 5
 21 qwe-r = 'wer'
 22 
 23 kfdsdlafhsdakfhdsakdfjkhsdakf = '太白'
 24 print(名字)
 25 AgeOfOldboy = 56
 26 
 27 NumberOfStudents = 80
 28 
 29 #下划线
 30 
 31 age_of_oldboy = 56
 32 
 33 number_of_students = 80
 34 
 35 
 36 age1 = 12
 37 age2 = age1
 38 age3 = age2
 39 age2 = 100
 40 age3 = 5
 41 print(age1,age2,age3) #12, 100 ,100
 42                       #12,12,12,
 43                       #12,100,12
 44                       #100,100,100,
 45 
 46 print(100,type(100))
 47 print('100',type('100'))
 48 
 49 print(1)
 50 print("jsdfdsfsadl;fjdsal;j")
 51 print("I'm a teacher")
 52 
 53 
 54 a = '泰哥'
 55 b = '小二'
 56 c = a + b
 57 print(c)
 58 print('泰哥' + '小二' +'货')
 59 
 60 print('坚强'*8)
 61 
 62 
 63 msg = """
 64 今天我想写首小诗,
 65 歌颂我的同桌,
 66 你看他那乌黑的短发,
 67 好像一只炸毛鸡。
 68 """
 69 #print(msg)
 70 print(True,type(True))
 71 print('True',type('True'))
 72 
 73 name = input('请输入你的名字:')
 74 age = input('请输入你的年龄:')
 75 print('我的名字是'+name,'我的年龄'+age+'岁')
 76 '''
 77 # 第一种:
 78 '''
 79 if 4 > 5 :
 80     print('我请你喝酒')
 81 print('喝什么酒')
 82 
 83 #第二种:
 84 if 4 > 5:
 85     print('我请你喝酒')
 86 else:
 87     print('喝什么酒')
 88 '''
 89 
 90 '''
 91 #多选:
 92 num = input('请输入您猜的数字:')
 93 
 94 if num == '1':
 95     print('一起抽烟')
 96 elif num == '2':
 97     print('一起喝酒')
 98 elif num == '3':
 99     print('新开了一家,走看看')
100 else:
101     print('你猜错了.....')
102 
103 
104 score = int(input("输入分数:"))
105 
106 if score > 100:
107     print("我擦,最高分才100...")
108 elif score >= 90:
109     print("A")
110 elif score >= 60:
111     print("C")
112 elif score >= 80:
113     print("B")
114 elif score >= 40:
115     print("D")
116 else:
117     print("太笨了...E")
118 
119 name = input('请输入名字:')
120 age = input('请输入年龄:')
121 
122 if name == '小二':
123     if age == '18':
124         print(666)
125     else:
126         print(333)
127 else:
128     print('错了....')
129 '''
130 
131 # while
132 '''
133 print('111')
134 while True:
135     print('我们不一样')
136     print('在人间')
137     print('痒')
138 print('222')
139 '''
140 # 从1--100
141 '''
142 count = 1
143 flag = True
144 #标志位
145 while flag:
146     print(count)
147     count = count + 1
148     if count > 100 :
149         flag = False
150 
151 
152 count = 1
153 while count <= 100:
154     print(count)
155     count = count + 1
156 
157 
158 count = 1
159 sum = 0
160 
161 while count <= 100:
162     sum = sum + count 
163     count = count + 1
164 
165 print(sum)
166 '''
167 
168 # break
169 '''
170 print('11')
171 while True:
172     print('222')
173     print(333)
174     break
175     print(444)
176 print('abc')
177 
178 count = 1
179 while True:
180     print(count)
181     count = count + 1
182     if count > 100:break
183 
184 
185 
186 
187 print(111)
188 count = 1
189 while count < 20 :
190     print(count)
191     continue
192     count = count + 1
193 '''
194 
195 count = 0
196 while count <= 100:
197     count += 1
198     if count > 5 and count < 95:
199         continue
200     print("loop ", count)
201 
202 print("-----out of while loop ------")
View Code






标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:初识Django,了解一下大概流程

下一篇:Python学习笔记(matplotlib篇)--坐标轴刻度