# line shift? (baby steps 2)

Jeff Lindholm jeff_news at lindholm.org
Tue Aug 24 20:41:20 CEST 2004

```>> import string
>>
>> currency = {"EUDK":(7.47,"? to DKK"),
>>             "DKEU":(0.13,"DKK to ?"),
>>             "USDK":(5.93, "\$ to DKK"),
>>             "DKUS":(0.16, "DKK to \$"),
>>             "EUUS":(1.19, "? to \$"),
>>             "USEU":(0.84, "\$ to ?")}
>>
>> while(1):
>>     currency_choice= raw_input("\nPlease enter conversion type  or
>> 'Exit':
>> ")
>>     currency_str= str(currency_choice).upper()
>>
>>     if currency_str == "EXIT":
>>         break
>>     if currency.has_key(currency_str):
>>         amount_int= input("Please type the amount you wish to convert: ")
>>         result = amount_int * currency[currency_str][0]
>>         print currency[currency_str][1], " ", amount_int, " = ", result
>>     else:
>>         print("Sorry. At the moment we only support DKK, Euro and
>> Dollars."
>> + "\n" \
>>         "Type DKEU if you want convert from DKK to ?," + "\n" \
>>         "EUDK if you want to convert from DKK to ?," + "\n" \
>>         "DKUS if you want to convert from DKK to \$," + "\n" \
>>         "USDK if you want to convert from \$ to DKK," + "\n"
>>         "EUUS if you want to convert from ? to \$," + "\n"\
>>         "and USEU if you want to convert from \$ to ?")
>
>
> was the following output intended?
>
> "Please enter conversion type  or 'Exit': euus
> Please type the amount you wish to convert: 99
> ? to \$   99  =  117.81"
>
> I mean the last line. Or am I missing something?
> Thanx!

Yes the last line was meant to show the conversion type, just a simple
remider for myself what I converted (in this case EU - designated ? - to US
dollars - designated \$)

```

More information about the Python-list mailing list