-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
64 lines (50 loc) · 1.26 KB
/
main.py
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
import calculate as cal
from datetime import datetime
import time
# 계산기 시작 안내 문구
print("******* 계산기 (Version 1.1) *******")
print()
print("project start : 2024-01-25")
print("현재 날짜 : ", datetime.now().date())
print()
print("************************************")
time.sleep(1)
# 숫자, 기호 순서
count = 0
sign = 0
calcul = cal.calculate()
# 입력
while (1):
time.sleep(1)
print()
print("식을 입력하세요")
print("종료하려면 'end'를 입력하세요")
# 기호 입력받기
if (count % 2 != 0):
sign = input("기호 : ")
if (sign == "end"):
break
# 숫자 입력받기
else:
try:
num_input = int(input("숫자 : "))
except:
break
if (sign == "+"):
answer = calcul.add(answer, num_input)
elif (sign == "-"):
answer = calcul.minus(answer, num_input)
elif (sign == "*"):
answer = calcul.multiplication(answer, num_input)
elif (sign == "/"):
answer = calcul.division(answer, num_input)
elif (sign == "**"):
answer = calcul.square(answer, num_input)
# 기호가 없을 때
else:
answer = num_input
count += 1
print(f"값 : {answer}")
print()
print("************************************")
time.sleep(1)