Python_Institute
PCEP-30-02 · Question #387
What is the expected result of the following code? ``python def velocity(x=10): return speed * x speed = 10 new_speed = velocity() new_speed = velocity(new_speed) print(new_speed) ``
The correct answer is A. The code is erroneous and cannot be run. See the full explanation below for the reasoning.
Question
What is the expected result of the following code?
def velocity(x=10):
return speed * x
speed = 10
new_speed = velocity()
new_speed = velocity(new_speed)
print(new_speed)
Options
- AThe code is erroneous and cannot be run.
- B20
- C10
- D30
How the community answered
(50 responses)- A84% (42)
- B10% (5)
- C2% (1)
- D4% (2)
Community Discussion
No community discussion yet for this question.