Thursday , September 19 2024

What is the output of the following snippet? z = y = x = 1 print(x, y, z, sep=’*’)

Questions BankCategory: Python Essentials 1What is the output of the following snippet? z = y = x = 1 print(x, y, z, sep=’*’)
What is the output of the following snippet?

z = y = x = 1
print(x, y, z, sep='*')
  • x y z
  • 1 1 1
  • x*y*z
  • 1*1*1

Explanation: Let’s analyze the example:

the variables z, y, and x are declared and initialized, and the value 1 is assigned to each of them by using the mechanism of assigning the same value to multiple variables,
the values assigned to the three variables are printed to the screen and separated by the * symbol using the sep keyword argument.

More Questions: Python Essentials 1 – Module 2 Test