Westonci.ca is the best place to get answers to your questions, provided by a community of experienced and knowledgeable experts. Explore comprehensive solutions to your questions from a wide range of professionals on our user-friendly platform. Get precise and detailed answers to your questions from a knowledgeable community of experts on our Q&A platform.

What is the output of the following code snippet if the variable named cost contains 100? if cost < 70 or cost > 150 : discount = 0.8 * cost else : discount = cost print("Your cost is ", discount)

Sagot :

Answer:

The output is: Your cost is  100

Explanation:

Given

The above code snippet

and

[tex]cost = 100[/tex]

Required

Determine the output of the code

if cost < 70 or cost > 150

The above condition checks if cost is less than 70 or cost is greater than 150

This condition is false because 100 is neither less than 70 nor is it greater than 150

So, the else statement will be executed.

discount = cost

Which means

discount = 100

So, the print instruction will print: Your cost is  100