Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    GIF shows where to locate </> in the thread and or post editor toolbar.
    To learn more about how to use our BBCode feature, review our "How to post your code into threads" here.

    Thank you, Code Forum.

Python currency converter error

kallum54

Coder
Hi I am a student and have been tasked to make a currency conveter but I need help
a line of code is not showing up this is the line of code SelectCurrency= str("input please select currency, select EUR, Select USD, Select BRL, Select JPY, Select TRY")
 
Hi I am a student and have been tasked to make a currency conveter but I need help
a line of code is not showing up this is the line of code SelectCurrency= str("input please select currency, select EUR, Select USD, Select BRL, Select JPY, Select TRY")
Hey Mate and welcome,

Could you provide the whole code please and whats not showing. Also dont forget to use BB Code 😀
 
Code:
[

#currency converter

#Start


Value= float( input ("Please Enter Amount in GBP: "))


if Value < 50:


    print ("Please enter a higher amount")


else:


    print (Value)


SelectCurrency= str("input please select currency, select EUR, Select USD, Select BRL, Select JPY, Select TRY")

this part is not showing up
 
Last edited by a moderator:
ok sorry m8
Python:
#Currency Converetor

#Start
Value= float( input ("Please Enter Amount in GBP: "))
if Value < 50:
print ("Please enter a higher amount")
else:
print (Value)

SelectCurrency= str(input ("please select currency, select EUR, Select USD, Select BRL, Select JPY, Select TRY")

if SelectCurrency== 'EUR'
(value1=(Value* 1.14 )-Value *0.01)
(print ("£", Value, "is equal", value1,SelectCurrency)
# this line above changes the currency from GBP to Euro's by multiplying the GBP by 1.14
# it then subtracts the commission charge of 0.01 of the value of the transaction total
#the program then prints the correct conversion in Euro's from GBP
 
Last edited by a moderator:
Sooo line 12 is missing a : at the end of the if statement
Line 10 is missing a )

Few other issues but try this on for size 😀


Python:
#Currency Converetor

#Start
Value = int(input ("Please Enter Amount in GBP: "))
if Value < 50:
    print ("Please enter a higher amount")
else:
    print (Value)

SelectCurrency = str(input ("please select currency, select EUR, Select USD, Select BRL, Select JPY, Select TRY:"))
if SelectCurrency == 'EUR':
    value1 = (Value * 1.14) - (Value * 0.01)
    print("£" + str(Value) + " is equal " + str(value1),SelectCurrency)
    # this line above changes the currency from GBP to Euro's by multiplying the GBP by 1.14
    # it then subtracts the commission charge of 0.01 of the value of the transaction total
    #the program then prints the correct conversion in Euro's from GBP

you can copy and paste mine but you get the point and see why said its not all python 😀
 
You could use a while loop so

Python:
#Currency Converetor

#Start
while True:
    Value = int(input ("Please Enter Amount in GBP: "))
    if Value < 50:
        print ("Please enter a higher amount")
    else:
        print (Value)

    SelectCurrency = str(input ("please select currency, select EUR, Select USD, Select BRL, Select JPY, Select TRY:"))
    if SelectCurrency == 'EUR':
        value1 = (Value * 1.14) - (Value * 0.01)
        print("£" + str(Value) + " is equal " + str(value1),SelectCurrency)
        # this line above changes the currency from GBP to Euro's by multiplying the GBP by 1.14
        # it then subtracts the commission charge of 0.01 of the value of the transaction total
        #the program then prints the correct conversion in Euro's from GBP

What this will do is unless a error is thrown or there is a query with the Break command in it will just loop over and over again
 
I feel like I'm doing your homework 😀 Try this

Python:
#Currency Converetor

#Start
while True:
    while True:
        Value = int(float(input ("Please Enter Amount in GBP: ")))
        if Value < 50:
            print ("Please enter a higher amount")
        else:
            print (Value)
            break
            

    while True:
        SelectCurrency = str(input ("please select currency, select EUR, Select USD, Select BRL, Select JPY, Select TRY:"))

        if SelectCurrency == 'EUR':
            value1 = (Value * 1.14) - (Value * 0.01)
            print("£" + str(Value) + " is equal " + str(value1),SelectCurrency)
            break

        elif SelectCurrency == 'USD':
            value1 = (Value * 1.14) - (Value * 0.01)
            print("£" + str(Value) + " is equal " + str(value1),SelectCurrency)
            break

        elif SelectCurrency == 'BRL':
            value1 = (Value * 1.14) - (Value * 0.01)
            print("£" + str(Value) + " is equal " + str(value1),SelectCurrency)
            break

        elif SelectCurrency == 'JPY':
            value1 = (Value * 1.14) - (Value * 0.01)
            print("£" + str(Value) + " is equal " + str(value1),SelectCurrency)
            break

        elif SelectCurrency == 'TRY':
            value1 = (Value * 1.14) - (Value * 0.01)
            print("£" + str(Value) + " is equal " + str(value1),SelectCurrency)
            break

        else:
            print("Please enter ether EUR,USD,BRL,JPY,TRY")

i could have put this into a function but i wanted to make the code easier to understand 🙂
 

Buy us a coffee!

Buy me a coffee.
Back
Top Bottom