Python勉強0 day_基礎知識
10405 ワード
print()
1 print("Hello Python")
1.'#'
2. 。
+
, , , ,
,python 。
:WeLovePython 。
:weLovePython 。
Number
str
tuple
Dictionary
set
1 import keywordi
2 print(keyword.kkwlist)
: '\' 。
1 s = 'I\'am Chinese'
2 t = 'C:\\user'
。
1. '%',
2. format
1 print("%s Love Python"%"I")
2 print("I am a %s,I'am %d years old "%('student',20))
3 print("I Love {}".format("Python"))
:'+' '-' '*' '/' '%' '// ' '**'
: '==' '>' '=' '<=' '!='
:'=' '+=' '-=' '*=' '/=' '//=' '%=' '**='
:and,or,not
:in,not in
, ,
if :
1
2
3
......
1 age = int(input(" :"))
2 if age < 18:
3 print(" ")
4 else:
5 print(" ")
for in :
1
2
......
1 for name in [' ', ' ', ' ']:
2 print(name)
3 for i in range(1, 10): # range()
4 print(i)
while :
-----break,continue,pass
break:
contonue: ,
pass:
for i in range(1, 10):
if i == 3:
print(' ')
continue
elif i == 5:
print(" ")
break
else:
print(i)
, ,
1 #
2 def func1():
3 print(" ")
4 #
5 def func2(a):
6 a +=10
7 print(a)
8 # , return, None
9 def func3(c):
10 c += 10
11 return c
12 func1()
13 func2(1)
14 print(func3(5))
help()
:
1 for a in range(1,10):
2 for b in range(1, a+1):
3 print('%d*%d=%d '%(a, b, a*b), end="")
4 print("")
転載先:https://www.cnblogs.com/Burtit/p/9279890.html