Question: In coding example 5 . 2 Order a taco, you were asked to write a program to order a customized taco. Why is this line

In coding example 5.2 Order a taco, you were asked to write a program to order a customized taco.
Why is this line of code prone to user error?
topping = toppings[int(top_choice)-1]
A user could enter a float, which lists can't index from.
A user could enter a number that would evaluate to an index that doesn't exist in the list
 In coding example 5.2 Order a taco, you were asked to

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!