-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
72 lines (53 loc) · 1.73 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
65
66
67
68
69
70
71
72
from constants import dollar_to_rial, price_dollar
from gold import gold_coin, price_gold
from time import sleep
import json
def exchanger_currency():
number_of_dollars = int(input('how much dollar you have? '))
result = dollar_to_rial(price_dollar, number_of_dollars)
print(f"{number_of_dollars} ِDollar(USD) = {result} Rial(IRR)")
sleep(3)
menu()
def exchanger_gold():
number_of_gold = int(input('how much gold coin you have? '))
result = gold_coin(price_gold, number_of_gold)
print(f"{number_of_gold} Gold Coin = {result} Rial(IRR)")
sleep(3)
menu()
def show_currency():
with open('archive/currency.json', 'r') as f:
data = json.loads(f.read())
for i in data:
print(i)
sleep(0.25)
sleep(3)
menu()
def show_gold():
with open('archive/gold.json', 'r') as f:
data = json.loads(f.read())
for i in data:
print(i)
sleep(0.25)
sleep(3)
menu()
def menu():
show_menu = True
while show_menu:
choice = input('1. for exchange USD to IRR press (1)\n'
'2. for see price currency press (2)\n'
'3. for see price golds press (3)\n'
'4. for see how many coins cost a few Rials press (4)\n'
'5. for exit press (e)\n'
'Please enter your choice: ')
if choice == 'e':
print('See You')
show_menu = False
elif choice == '1':
exchanger_currency()
elif choice == '2':
show_currency()
elif choice == '3':
show_gold()
elif choice == '4':
exchanger_gold()
menu()