-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpython_basic_jm_11.py
More file actions
81 lines (59 loc) · 1.12 KB
/
python_basic_jm_11.py
File metadata and controls
81 lines (59 loc) · 1.12 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
62
63
64
65
66
67
68
69
70
71
72
'''
조건문
'''
print(type(True))
print(type(False))
# 예1
if True:
print("True")
# 관계연산자
# >, >=, <, <=, ==, !=
a = 10
b = 0
print(a == b)
print(a != b)
print(a > b)
print(a < b)
print()
# 참/ 거짓 종류
# 참 : "내용", [내용], (내용), {내용}, 1
# 거짓 : "", [], {}, (), 0
data = "1"
if data:
print(">>>>True")
else:
print(">>>>Flase")
# 논리연산자
# and or not
a = 100
b = 60
c = 15
print('and : ', a > b and a < b)
print('or : ', a > b or a < b)
print(not False)
print(not True)
print()
# 산술, 관계, 논리 연산자
# 산술 > 관계 > 논리 순서로 적용 됨
print(5 + 10 > 0 and not 7 + 3 == 10)
# 다중 조건문
# 등급 정하기
score = 94
if score > 90:
print("A등급입니다.")
elif score > 80:
print("B등급입니다.")
elif score > 70:
print("C등급입니다.")
elif score > 60:
print("꽝")
# 중첩 조건문
age = 24
height = 160
if age > 20 :
if height > 150:
print("놀이기구 이용 가능합니다.")
else:
print("놀이기구 이용 불가능합니다.")
else :
print("입장 불가능합니다. ")