126k views
1 vote
Try to answer the following question without running the code in Python:

If we run the following program:
a = 2 + 6
b = 7 % 3
c = a - b
c = c * 5
print(c)

what gets printed?

User Jfeust
by
7.7k points

1 Answer

1 vote

Answer:

35

Explanation:

Given

the above lines of code

Required

What's the output

We'll analyze the code line by line

a = 2 + 6

At this point a = 8

b = 7 % 3

At this point b = 1. This is so because, the remainder of 7%3 is 1

c = a - b

At this point c = 7;

This is calculated by c = 8 - 1 = 7

c = c * 5

At this point; c = 35

This is calculated by: c = 7 * 5 = 35

print(c)

The value of c, which is 35 is printed

User Sebastian Hajdus
by
7.7k points

No related questions found

Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.

9.4m questions

12.2m answers

Categories