Python | Currency Converter

/ 7 Jul 2013 /
This is my fifth program, and pretty much when I knew that I could build complex things with a little practice, I learned how to assign a function to an if statement, and there are literally millions of things to do with that, so It was pretty cool.


 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
def autous():
    while 1:
        print("Welcome to my AU -> US Currency Converter!")
        am = int(input('Enter the amount of AU dollars you would like to convert:  '))
        us = 0.91
        lol = am * us
        print(lol)

def autoc():
    while 1:
        print("Welcome to my AU -> CAD Currency Converter!")
        am = int(input("Enter the amount of AU dollars you would like to convert:  "))
        ca = 0.96
        lol = am * ca
        print(lol)

def ustoc():
    while 1:
        print("Welcome to my US -> CAD Currency Converter!")
        am = int(input("Enter the amount of US dollars you would like to convert:  "))
        ca = 0.95
        lol = am / ca
        print(lol)

def autolb():
    while 1:
        print("Welcome to my AU -> LBP Currency Converter!")
        am = int(input("Enter the amount of AU dollars you would like to convert:  "))
        lb = 1350
        lol = am * lb
        print(lol)

def autojp():
    while 1:
        print("Welcome to my AU -> YEN Currency Converter!")
        am = int(input("Enter the amount of AU dollars you would like to convert:  "))
        jp = 91
        lol = am * jp
        print(lol)


print('''Currency Converters:
1) Australian Dollars --> American Dollars
2) Australian Dollars --> Canadian Dollars
3) American Dollar --> Canadian Dollars
4) Australian Dollar --> Lebanese Pound
5) Australian Dollar --> Japanese Yen
''')

def choice():
    choice = int(input("Choose currency converter :  "))
    if choice == 1:
        autous()
    elif choice == 2:
        autoc()
    elif choice == 3:
        ustoc()
    elif choice == 4:
        autolb()
    elif choice == 5:
        autojp()
    elif choice == ' ' | '':
        print("Why did you write nothing? You think this is funny? You think I didn't already fix this?")
    else:
        print("Please choose a currency by the listed number.")

choice()
 
Copyright © 2010 M(ath)+me, All rights reserved