asked 176k views
5 votes
For questions 2-4, consider the following code:

if (month ==9):
if (day > 15):
print ("Second half of the month")
else:
print ("First half of the month")
else:
print ("Not in September")
What is the output if month = 9 and day = 14?

asked
User Marcopeg
by
8.2k points

2 Answers

12 votes

Answer:

e

Step-by-step explanation:

answered
User Kenjiro
by
8.3k points
6 votes

Answer:

First half of the month

Step-by-step explanation:

Given

The above lines of code

Required

Determine the output if month = 9 and day = 14

The first if statement: if (month ==9): checks if month equals 9.

This statement is true, so the next statement is executed.

The next executable statement:

if (day > 15):

checks if day is greater than 15.

This statement is false, so the else statement is executed

else:

print ("First half of the month")

The above statement is executed and the string "First half of the month" is printed

answered
User Tsundoku
by
7.9k points

No related questions found