QUESTION IMAGE
Question
question 10 given x = 40, what is the final value of y? if x > 30: y = x - 10 else: y = x + 10 40 30 50
Step1: Check the condition
Given $x = 40$, and the condition is $x>30$. Since $40>30$, the 'if' - part of the code will be executed.
Step2: Calculate y
The formula in the 'if' - part is $y=x - 10$. Substitute $x = 40$ into the formula, we get $y=40 - 10=30$.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
30