What will be the output produced by following code?
(i) print(print(“Hola”))
(ii) print(print(“Hola” , end = “ ”)
Match your result after executing above statements. Explain the reason
Answers
Answered by
17
Output produced by the code
i) print (print ("Hola"))
output ->
Hola
None
- There are two print ... see the dry run.
- print (print ("Hola"))
- First print("Hola")
- Above statement will print Hola and for next print there is no content inside the bracket.
- Then print ()
- It has nothing so it will print None
ii) print (print ("Hola",end=" "))
output ->
Hola None
- There are two print ... see the dry run.
- print (print ("Hola",end= " "))
- First print("Hola",end= " ")
- Above statement will print Hola and for next print there is no content inside the bracket. And end statement will make the next print in same line.
- Then print ()
- It has nothing so it will print None.
End - It is used to make the cursor in same line. It will not change the line.
Matching the result after executing above statements.
First result -
Hola
None
Second result -
Hola None
The difference that is seen between both the output it is because of using end.
Answered by
0
Answer:
rupdsgsjfsfkssvy. vmxgks
Similar questions