What will be the output after the following statements?def call(var) : print(var, end ='') call(45)Options5545var4 5
Question
What will be the output after the following statements?def call(var) : print(var, end ='') call(45)Options5545var4 5
Solution
The output will be 45.
Here's the step by step explanation:
-
A function named
callis defined, which takes one argumentvar. This function prints the value ofvarwithout adding a newline at the end (due toend = ''). -
The function
callis called with the argument45. -
The function prints
45and since there is no newline character at the end, the cursor remains on the same line.
So, the output of the given code will be 45.
Similar Questions
What will be the output after the following statements? myvar = 5 def printvar(): print(myvar, end ='') printvar() printvar() Options 55 5 5 5 10
Test time left: 11:53 Choose the Correct Answer(s) What will be the output after the following statements? def call(y, x): return x / y z = call(4, 9) print(z) Options 0.444445 2 0 2.25
What will be the output after the following statements?def xyz(): a = 56 xyz() print(a)OptionsNameErrora = 56xyz56
What will be the output after the following statements?x = 'Python' print(x.join('33'))OptionsPython33Python3Python 333Python3
What will be the output of the following Python code?def ct(y): global y y+=2 print(y)ct(5)print("hi")Optionserrorhi77hi
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.