0% found this document useful (0 votes)
3 views4 pages

Python Output Guessing Practice

The document contains a series of Python programming exercises designed to test the reader's understanding of output generation. Each program includes a code snippet followed by a placeholder for the output and an explanation section. The exercises cover various programming concepts such as arithmetic operations, conditionals, loops, and list manipulation.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

Python Output Guessing Practice

The document contains a series of Python programming exercises designed to test the reader's understanding of output generation. Each program includes a code snippet followed by a placeholder for the output and an explanation section. The exercises cover various programming concepts such as arithmetic operations, conditionals, loops, and list manipulation.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Python Programs – Guess the Output (Practice Questions)

Program 1
x=8

y=3

z=x+y*2

print(z)

Output:

___________________________________________________________________________________________________[1]

Explanation:

______________________________________________________________________________________________________[1]

Program 2
temperature = 35

if temperature > 30:

print("Hot")

elif temperature == 30:

print("Warm")

else:

print("Cold")

Output:

____________________________________________________________________________________________[1]

Explanation:

______________________________________________________________________________________________________[1]

Program 3
numbers = [1, 2, 3, 4, 5]
total = 0

for number in numbers:

total += number * 2

print(total)

Output: __________________________________________________________________________________ [1]

Explanation:

______________________________________________________________________________________________________[1]

Program 4
nums = [10, 15, 20, 25, 30]

total = 0

for n in nums:

if n % 2 == 0:

total += n

print(total)

Output:

Explanation:

__________________________________________________________________________________________________[1]

Program 5
data = [3, 6, 2, 9, 12, 1]

count = 0

for item in data:

if item > 5:

count += 1
print(count)

Output:

______________________________________________________________________________________________________[1]

Explanation:

_____________________________________________________________________________________________________[1]

Program 6

a = 10

b = 20

c = a * b - 5

d = c / 2

print(d)

print(c)

Output:

________________________________________________________ [1]

Explanation:

________________________________________________________________________

______________________________________________________ [1]

Program 7
x=6

y=2
z=x*y+4-y

print(z)

Output:
____________________________________________________________________________________________________ [1]

Explanation:

_________________________________________________________________________________________________________

______________________________________________________________________________[1]

Program 9
a = 10

b=3

c=a%b+b*2

print(c)

Output:
____________________________________________________________________________________________________ [1]
Explanation:
_________________________________________________________________________________________________________

______________________________________________________________________________[1]

Program 10
p=8

q = p // 3

r=q+p%3

print(r)

Output:
____________________________________________________________________________________________________ [1]
Explanation:

_________________________________________________________________________________________________________

______________________________________________________________________________[1]

You might also like