Python Programming - Variables - Discussion
Discussion Forum : Variables - General Questions (Q.No. 9)
9.
What is the output of the following code:
x = 10; y = 3
z = x % y
print(z)
Answer: Option
Explanation:
In Python, the %
operator is used to calculate the remainder of a division operation. In this case, 10 divided by 3 has a remainder of 1, which is stored in the variable z
and printed to the console.
Python does not usually use explicit line-ending characters; the parser can almost always figure out where a statement ends from the positioning of newlines. However, Python's syntax allows you to use a semicolon to end a statement instead, which allows you to place multiple statements on a single line.
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers