طبعا هذا حلي قبل لا اشوف حل الاستاذ ولو اني متاكد انه حلي فجهة وحل الاستاذ فجهة
ههههههههههههههههههههههههههههههههه
import os
import time
currencies = {
'USA': 1.0,
'EUR': 0.85,
'EGP': 30.9,
'RMB': 6.5,
}
def clear_terminal():
os.system('cls' if os.name == 'nt' else 'clear')
def exchange_rate(from_currency , to_currency):
return currencies[to_currency] / currencies[from_currency]
def final_transaction(from_currency,to_currency,amount):
clear_terminal()
print (f"Preparing the deal from {from_currency} to {to_currency} Please wait\n")
time.sleep(2)
currency = exchange_rate(from_currency , to_currency)
print (f"Exchange Rate: 1 {from_currency} = {currency} {to_currency}\n\n")
print (f'{amount} {from_currency} is equal to {amount * currency} {to_currency}\n')
print ("Transaction Completed.") if input ('Dou want accept this transaction? (Y/N): ').lower() == 'y' else print ('Transaction Canceled.')
while True:
clear_terminal()
print ("Welcome to 'Currency Coverter':")
print ("""
||====================================================================||
||//$\\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\//$\\||
||(100)==================| FEDERAL RESERVE NOTE |================(100)||
||\\$// ~ '------========--------' \\$//||
||<< / /$\ // ____ \\ \ >>||
||>>| 12 //L\\ // ///..) \\ L38036133B 12 |<<||
||<<| \\ // || <|| >\ || |>>||
||>>| \$/ || $$ --/ || One Hundred |<<||
||====================================================================||>||
||//$\\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\//$\\||<||
||(100)==================| FEDERAL RESERVE NOTE |================(100)||>||
||\\$// ~ '------========--------' \\$//||\||
||<< / /$\ // ____ \\ \ >>||)||
||>>| 12 //L\\ // ///..) \\ L38036133B 12 |<<||/||
||<<| \\ // || <|| >\ || |>>||=||
||>>| \$/ || $$ --/ || One Hundred |<<||
||<<| L38036133B *\\ |\_/ //* series |>>||
||>>| 12 *\\/___\_//* 1989 |<<||
||<<\ Treasurer ______/Franklin\________ Secretary 12 />>||
||//$\ ~|UNITED STATES OF AMERICA|~ /$\\||
||(100)=================== ONE HUNDRED DOLLARS =================(100)||
||\\$//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\$//||
||====================================================================||""")
print ("\n\n\n------------------------------------------------------------------------\n")
for currency in currencies:
short_cut = currencies[currency]
print (f"{currency}: {short_cut}")
input_currency_from = input ("\nChoose a currency to convert from: ").upper()
input_amount = float(input ("Enter the amount: "))
confirm = input(f"\nYou entered {input_amount} Confinrm? (Y/N): ")
while confirm != "y":
input_amount = float(input("Enter the amount: "))
confirm = input(f"\nYou entered {input_amount} Confinrm? (Y/N): ")
clear_terminal()
input_currency_to = input ("Choose a currency to convert to: ").upper()
print ("Analyzing your request... Please wait.")
time.sleep(2)
print (f"Checking for {input_currency_to}'s best retes availalbe..... Please wait")
time.sleep(2)
print (f"Getting a discount price for {input_currency_from} Please wait")
time.sleep(1)
if input_currency_from in currencies:
final_transaction(input_currency_from,input_currency_to,input_amount)
if input ("Dou you want to perform another conversion? (Y/N): ").lower() != 'y':
break
else:
print("Invalid currency. Conversion canceled.")
time.sleep(3)
clear_terminal()