Monday 20 November 2023

Value Convertor

 

 

 

 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
def convert_temperature():
    print("\n Which conversion do you want to choose:-")
    print("1. Celsius to Faranheit")
    print("2. Faranheit to Celsius")
    choice = int(input("Enter your choice: "))
    if choice == 1:
        temp = float(input("Enter temperature in celsius: "))
        print(f"{temp} degree celsius is equal to {(temp*9/5)+32} degree faranheit.\n")
    elif choice == 2:
        temp = float(input("Enter temperature in faranheit: "))
        print(f"{temp} degree faranheit is equal to {(temp-32)*5/9} degree celsius.\n")
    else:
        print("Invalid input...please try again\n")

def convert_currency():

    print("\n Which conversion do you want to choose:-")
    print("1. Dollar to pound")
    print("2. Pound to Dollar")
    print("3. Dollar to Rupees")
    print("4. Rupees to Dollar")
    choice = int(input("Enter your choice: "))

    if choice == 1:
        value = float(input("Enter currency in dollars: "))
        print(f"{value} dollars in pounds will be {value*0.73}\n")
    elif choice == 2:
        value = float(input("Enter currency in pounds: "))
        print(f"{value} pounds in dollars will be {value/0.73}\n")
    elif choice == 3:
        value = float(input("Enter currency in dollar: "))
        print(f"{value} dollars in rupees will be {value*83.32}\n")
    elif choice == 4:
        value = float(input("Enter currency in Rupees: "))
        print(f"{value} rupees in dollars will be {value/83.32}\n")

def convert_lengths():

    print("\n Which conversion do you want to choose:-")
    print("1. Centimeters to foot and inches")
    print("2. Foot and inches to centimeter")
    choice = int(input("Enter your choice: "))
    if choice == 1:
        value = float(input("Enter length in cm: "))
        inches = value/2.54
        feet = inches/12
        print(f"{value} centimeters in equal to {feet} feet and {inches} inch\n")
    elif choice == 2:
        feet = float(input("Enter length in feet: "))
        inches = float(input("Enter length in inches: "))
        length = (feet*12 + inches)*2.54
        print(f"{feet} feet and {inches} inches in centimeters will be {length}\n")

print("===== Welcome to Value Converter =====")
while 1:
    print("Which option would you like to choose:-")
    print("1. Convert temperature")
    print("2. Convert currency")
    print("3. Convert lengths")
    print("4. Exit")
    choice = int(input("Enter your choice: "))
    if choice == 1:
        convert_temperature()
    elif choice == 2:
        convert_currency()
    elif choice == 3:
        convert_lengths()
    elif choice == 4:
        print('Exiting...')
        exit(0)

 

 

 

 ===== Welcome to Value Converter =====
Which option would you like to choose:-
1. Convert temperature
2. Convert currency
3. Convert lengths
4. Exit
Enter your choice:
2

 Which conversion do you want to choose:-
1. Dollar to pound
2. Pound to Dollar
3. Dollar to Rupees
4. Rupees to Dollar
Enter your choice:
3
Enter currency in dollar:
20
20.0 dollars in rupees will be 1666.3999999999999

Which option would you like to choose:-
1. Convert temperature
2. Convert currency
3. Convert lengths
4. Exit
Enter your choice:
2

 Which conversion do you want to choose:-
1. Dollar to pound
2. Pound to Dollar
3. Dollar to Rupees
4. Rupees to Dollar
Enter your choice:
4
Enter currency in Rupees:
80
80.0 rupees in dollars will be 0.9601536245799329

Which option would you like to choose:-
1. Convert temperature
2. Convert currency
3. Convert lengths
4. Exit
Enter your choice:
3

 Which conversion do you want to choose:-
1. Centimeters to foot and inches
2. Foot and inches to centimeter
Enter your choice:
1
Enter length in cm:
156
156.0 centimeters in equal to 5.118110236220472 feet and 61.41732283464567 inch

Which option would you like to choose:-
1. Convert temperature
2. Convert currency
3. Convert lengths
4. Exit
Enter your choice:
1

 Which conversion do you want to choose:-
1. Celsius to Faranheit
2. Faranheit to Celsius
Enter your choice:
1
Enter temperature in celsius:
32
32.0 degree celsius is equal to 89.6 degree faranheit.

Which option would you like to choose:-
1. Convert temperature
2. Convert currency
3. Convert lengths
4. Exit
Enter your choice:
4
Exiting...

No comments:

Post a Comment