Computer Science
Make change in the expression for z in the Python code given below so that the output produced is zero. You cannot change the operators and order of variables. (Hint. Use a function around a sub-expression)
x, y = 4, 8
z = x/y*y
print(z)
Python Data Handling
21 Likes
Answer
x, y = 4, 8
z = int(x/y)*y
print(z)
Answered By
12 Likes
Related Questions
What will be the output of following Python code?
a = 12 b = 7.4 c = 1 a -= b print(a, b) a *= 2 + c print(a) b += a * c print(b)
What will be the output of following Python code?
x, y = 4, 8 z = x/y*y print(z)
Consider the following expression:
x = "and" * (3 + 2) > "or" + "4"
What is the data type of value that is computed by this expression?
Consider the following code segment:
a = input() b = int(input()) c = a + b print(c)
When the program is run, the user first enters 10 and then 5, it gives an error. Find the error, its reason and correct it