-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpractice1.py
More file actions
61 lines (61 loc) ยท 1.13 KB
/
Copy pathpractice1.py
File metadata and controls
61 lines (61 loc) ยท 1.13 KB
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
55
56
57
58
59
60
61
print('Hello, world!')
print('Python Programming')
a = 2 + 2 # ๋ํ๊ธฐ
if a == 3:
print(a)
else:
print('3์ด')
print('์๋๋๋ค.')
# ์ฌ์น์ฐ์ฐ
a1 = 6 + 8
a2 = 6 - 8
a3 = 6 * 8
print(a1, a2, a3)
b1 = 5 // 2
b2 = 5 / 2
b3 = 5 % 2
b4 = 5 ** 2
print(b1, b2, b3, b4)
# ๊ฐ์ ์ ์ํ(Casting)
c1 = int(3.4)
c2 = int(5/2)
c3 = int('10')
# ๊ฐ์ฒด ์๋ฃํ ํ์
c4 = type(10.5)
print(c1, c2, c3, c4)
# ๋ชซ๊ณผ ๋๋จธ์ง๋ฅผ ํจ๊ป ๊ตฌํ๊ธฐ
d1 = divmod(5, 2)
d2 = type(d1)
# quotient, remainder
qu, re = divmod(7, 3)
print(d1, d2)
print(qu, re)
# base2, base8, base16
e1 = 0b1110
e2 = 0o11
e3 = 0xF
print(e1, e2, e3)
# ์ค์ ๋ง์
, ๋บ์
, ๊ณฑ์
, ๋๋์
, ๊ทธ๋ฆฌ๊ณ ์ ์์ ๋ง์
f1 = 3.5 + 2.1
f2 = 4.3 - 2.7
f3 = 1.5 * 3.1
f4 = 5.5 / 3.1
f5 = 4.2 + 5
print(f1, f2, f3, f4, f5)
# ๋ณต์์(complex number)
g1 = complex(1.2, 1.3)
print(g1)
print(int(0.2467 * 12 + 4.159))
print(102 * 0.6 + 225)
# ๋ณ์ ์ฌ๋ฌ ๊ฐ๋ฅผ ํ ๋ฒ์ ๋ง๋ค๊ธฐ
x, y, z = 10, 20, 30
print(x, y, z)
x1 = y1 = z1 = 10
print(x1, y1, z1)
x2, y2 = 10, 20
print(x2, y2)
x2, y2 = y2, x2
print(x2, y2)
# ๋น ๋ณ์๋ฅผ ๋ง๋ค๋๋ None์ ํ ๋น
x= None
print(x)