Here is the latest
error:
The Currency Exchange
Program
By Nathan Pinno Traceback (most recent
call last):
File "D:\Python24\exchange.py", line 27, in -toplevel- store = open('exch.txt', 'b')#load IOError: invalid mode: b and the latest
code:
import pickle
rates = {'can_us' : 0.80276, 'us_can' : 1.245702, 'can_euro' : 1.488707, 'euro_can' : 0.671724} def
menu():
print "1. Change Canadian currency into American." print "2. Change American currency into Canadian." print "3. Change Canadian currency into Euros." print "4. Change Euros into Canadian currency." print "5. Update exchange rates." print "9. Save and Exit" def
exchange_update():
print "1. Update Canadian to US rate." print "2. Update US to Canadian rate." print "3. Update Canadian to Euro rate." print "4. Update Euro to Canadian update." print "5. Main menu" def
menu_choice():
return int(raw_input("Which option? ")) print "The Currency
Exchange Program"
print "By Nathan Pinno" store = open('exch.txt', 'b')#load exch = pickle.load(store) store.close() while 1: menu() menu_option = menu_choice() if menu_option == 1: can = float(raw_input("Canadian $")) print "US $",can*rates['can_us'] elif menu_option == 2: us = float(raw_input("US $")) print "CAN $",us*rates['us_can'] elif menu_option == 3: can = float(raw_input("CAN $")) print "Euros",can*rates['can_euro'] elif menu_option == 4: euro = float(raw_input("Euros")) print "CAN $",euro*rates['euro_can'] elif menu_option == 5: while 1: exchange_update() sub = menu_choice() if sub == 1: new_can = float(raw_input("New CAN-US Exchange rate: ")) rates['can_us'] = new_can print "Exchange rate successfully updated!" elif sub == 2: new_us = float(raw_input("New US-CAN Exchange rate: ")) rates['us_can'] = new_us print "Exchange rate successfully updated!" elif sub == 3: new_cxr = float(raw_input("New CAN-Euro Exchange rate: ")) rates['can_euro'] = new_cxr print "Exchange rate successfully updated!" elif sub == 4: new_euro = float(raw_input("New Euro-CAN Exchange rate: ")) rates['euro_can'] = new_euro print "Exchange rate successfully updated!" elif sub == 5: break elif menu_option == 9: store = open("exch.txt", 'wb') #save pickle.dump(exch, store) store.close() break print "Goodbye." How do I fix it this
time?
Thanks,
Nathan Pinno,
MSN Messenger: [EMAIL PROTECTED]
Yahoo! Messenger: spam_swatter31
AIM: f3mighty
ICQ: 199020705
|
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor