Q.2: Aashna has written following expressions in python.
a= -4%1.5
b= -4//1.5
C= 4.0/5
d = 4/5
Find out the values stored by a, b, c, and d.
Answers
Answered by
1
Answer:
a= -4%1.5
a = 0.5
why - because modulo % divides the numbers and return the remainder so the remainder is stored in a
b= -4//1.5
b = -3.0
Why because the // division sign (Floor Division Sign - division that results into whole number adjusted to the left in the number line ) divided the numbers and returns a whole integer not floating points.
C= 4.0/5
c = 0.8
Why in python when dividing it converts all to floating numbers and divide so it becomes 4.0/5.0 and yield 0.8
d = 4/5
d = 0.8
Why - same as the above divides and yields a 0.8
Explanation:
Find out the values stored by
a = 0.5
b = -3.0
c = 0.8
d = 0.8
Similar questions
Science,
1 month ago
Physics,
1 month ago
Math,
1 month ago
Biology,
2 months ago
Science,
2 months ago
Math,
9 months ago
Business Studies,
9 months ago
Computer Science,
9 months ago