Thinkun

Chaos is a ladder.

导航

Python day1

一、

1.第一个程序HelloWord

name = "Hello Word!"
print(name)

 2.打印❤

print('\n'.join([''.join([('LovePython'[(x-y)%10]if((x*0.05)**2+(y*0.1)**2-1)**3-(x*0.05)**2*(y*0.1)**3<=0 else' ')for x in range(-30,30)])for y in range(15,-15,-1)]))

 3.三级目录

 1 __author__ = "Alex Li"
 2 
 3 data = {
 4     '北京':{
 5         "昌平":{
 6             "沙河":["oldboy","test"],
 7             "天通苑":["链家地产","我爱我家"]
 8         },
 9         "朝阳":{
10             "望京":["奔驰","陌陌"],
11             "国贸":{"CICC","HP"},
12             "东直门":{"Advent","飞信"},
13         },
14         "海淀":{},
15     },
16     '山东':{
17         "德州":{},
18         "青岛":{},
19         "济南":{}
20     },
21     '广东':{
22         "东莞":{},
23         "常熟":{},
24         "佛山":{},
25     },
26 }
27 exit_flag = False
28 
29 while not exit_flag:
30     for i in data:
31         print(i)
32     choice = input("选择进入1>>:")
33     if choice in data:
34         while not exit_flag:
35             for i2 in data[choice]:
36                 print("\t",i2)
37             choice2 = input("选择进入2>>:")
38             if choice2 in data[choice]:
39                 while not exit_flag:
40                     for i3 in data[choice][choice2]:
41                         print("\t\t", i3)
42                     choice3 = input("选择进入3>>:")
43                     if choice3 in data[choice][choice2]:
44                         for i4 in data[choice][choice2][choice3]:
45                             print("\t\t",i4)
46                         choice4 = input("最后一层,按b返回>>:")
47                         if choice4 == "b":
48                             pass
49                         elif choice4 == "q":
50                             exit_flag = True
51                     if choice3 == "b":
52                         break
53                     elif choice3 == "q":
54                         exit_flag = True
55             if choice2 == "b":
56                 break
57             elif choice2 == "q":
58                 exit_flag = True

 

posted on 2019-08-07 22:08  思远行更远  阅读(92)  评论(0编辑  收藏  举报