0

Python

How do you convert a value stored in a dictionary into an integer so I can multiply it by an integer https://code.sololearn.com/c9LAcg0PEvZr/?ref=app

13th Feb 2019, 4:34 PM
Safina Nganga
Safina Nganga - avatar
1 Answer
+ 2
Try it like this. So that the user input is checked against the available courses and you can make sure that your message is correct (no error due to wrong dictionary key). Your dictionary values are already integers. if course in courseid: print("You are taking",course,"which is",number_credits[course],"credits costing you",TUITION) else: print('Wrong course ID')
16th Feb 2019, 12:40 PM
Tibor Santa
Tibor Santa - avatar