IF statement picking first option in currency converter (python)
<pre><code>print "Pound Sterling converter"
print "You can convert pounds to either dollars, euros or yen"

print

dollar = 0
euro = 0
yen = 0

convert_to = input ("What currency do you want to convert to? ")
amount = input("How much would you like to convert? ")

print

if convert_to == dollar:
    amount = amount * 1.3
elif convert_to == euro:
     amount = amount * 1.17
elif convert_to == yen:
    amount = amount * 133.66
else:
    print "You must pick either dollar, euro or yen."

print amount
</code></pre>

<p>I'm a beginner in Python, as you can probably tell. All I want this program to do is have the user choose a currency (convert_to) and then choose how much they want to convert (amount) and then the program will convert it for them.</p>

<p>When I run the program, the if statement does not work correctly. Instead of seeing what convert_to is, it goes through the convert_to == dollar part regardless of if you type euro or yen. The numbers they are being multiplied by are simply the conversion rates from pounds.</p>

<p>also, a side note but less important one, the final else part does not work. The program brings up a "input not defined" error instead of printing "You must pick either dollar, euro or yen."</p>

<p>Thanks in advance</p>

<p>Your code is not working because you're assuming that the <code>input()</code> function returns an integer. It does not. The <code>input()</code> function returns a string, so this:</p>

<p><code>convert_to == dollars</code> </p>

<p>is equal to: </p>

<p><code>str == 1</code></p>

<p>which will never be true. Just change what you're comparing to to a string. 
Instead of using a variable just say <code>convert_to == "dollars"</code>, and so on for the other choices. Also, you must change this line <code>amount = input("How much would you like to convert? ")</code> to this <code>amount = int(input("How much would you like to convert? "))</code>, so you can get the input as an integer and not a string.</p>

<pre><code>print "Pound Sterling converter"
print "You can convert pounds to either dollars, euros or yen"


convert_to = raw_input("What currency do you want to convert to? ")
amount = int(raw_input("How much would you like to convert? "))


if convert_to == "dollars":
    amount *= 1.3
elif convert_to == "euros":
     amount *=  1.17
elif convert_to == "yen":
    amount *= 133.66
else:
    print "You must pick either dollar, euro or yen." 

print amount
</code></pre>

python if-statement