Skip to content

Commit e8adc62

Browse files
authored
Create 01_basic.py
1 parent 3eaefb1 commit e8adc62

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

  • 01.PythonStackEngineerFullEditionVideoTutorial
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/usr/bin/env python
2+
#_*_coding:utf-8_*_
3+
4+
# 001 变量,输出
5+
'''name = "Jack"
6+
print("hello word!","您好:",name,sep="")
7+
8+
# 002 输入
9+
import getpass
10+
# 将用户输入的内容赋值给 name 变量
11+
pwd = getpass.getpass("请输入密码:")
12+
13+
# 打印输入的内容
14+
print(pwd)
15+
16+
17+
del pwd
18+
age = int(input("输入int:"))
19+
print("age:",age)
20+
'''
21+
22+
# step 003 集合
23+
# 元组(不可变列表)
24+
name_list = ['alex', 'seven', 'eric']
25+
name_list = list(['alex', 'seven', 'eric'])
26+
#字典(无序)
27+
person = {"name": "mr.wu", 'age': 18}
28+
person = dict({"name": "mr.wu", 'age': 18})
29+
30+
for i in person:
31+
print(i,person[i]);
32+
33+
# step 004 if
34+
'''
35+
age = 20
36+
if age > 20 :
37+
print("大于20")
38+
elif age > 30 :
39+
print("大于30")
40+
else:
41+
print("其他")
42+
'''
43+
44+
# step 004 for while break continue
45+
'''
46+
for i in name_list:
47+
if i == 'seven':
48+
print("找到seven")
49+
break;
50+
print(i)
51+
52+
count = 1
53+
while True:
54+
count+=1
55+
if count==10:
56+
continue;
57+
elif count==20:
58+
break;
59+
else:
60+
print("");
61+
print("循环次数",count)
62+
'''
63+
64+
# step 005 三元运算
65+
choice = True==False
66+
result = "ok" if choice else "No"
67+
print(result)
68+
69+
# step 006 模块
70+
import os,sys
71+
#print(os.environ)
72+
#print(sys.path)

0 commit comments

Comments
 (0)