-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path练习_022311.py
54 lines (54 loc) · 1.07 KB
/
练习_022311.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#练习(参考书籍《Python编程:从入门到实践》)
#hello world!
print("Hello,Python world!")
a="Hello,Python world!"
print(a)
b="hello,Python world!"
print(b.title())
c="Hello"
d="Python world"
e=c+","+d+"!"
print(e)
#列表,for循环,if语句
f=["miny","caorizhou"]
print(f)
print(f[0].title())
print(f[1].title())
print(f[-1].title())
f.append("hhh")
print(f)
print(f[-1].title())
del f[-1]
print(f)
for people in f:
print("Hello!"+people.title()+"!")
print("Thank you!")
for g in range(1,100):
print(g)
h=["miny","caorizhou","hhh"]
for i in h:
if i == "hhh":
print("hhh!")
else:
print("Hello!"+i.title()+"!")
j=["a","b","c","d","e"]
if "a" in j:
print("Hello!"+j[0]+"!")
for k in j:
if "a" == j:
print("Hello!a!")
if "a" != j:
print("Hello!"+k+"!")
age=13
if age <= 4:
print("Hello!")
elif age <= 18:
print("Hey!")
else:
print("Hi!")
#字典
cats={"rn":"gary","ns":"blue"}
print(cats["rn"])
print(cats["ns"])
for abcde in range(0,1000000):
print(abcde)