Uploaded by hardeep Bilaspur

Assign2 573

advertisement
CPCM – 2024W
CSD 1233: Python Programming
Assignment #2
Student name: Hardeep Singh
Student id: c0926573
STEP 1:
USING INPUT FUNCTION FOR ASKING USER MONTHS FROM 1-12
number_of_month=int(input("Enter number of month from 1-12 :"))
STEP 2:
USING if, elif, and (logical operator)
CASE 1:
number_of_month (VARIABLE):
INDICATING MONTH NUMBER WHICH
WILL BE ENTERING IN INPUT
If the user enters either 1, 2, 3, or 4, the month it included in the first quarter
Enter 4 in the console.
Case 2: If the user enters a number between 5,6 and 7, the month it is included in the
second quarter.
Enter 6 in the console
CASE 3:
If the number is either 8 or 9, the month is included in the third quarter.
Enter 8 in the console.
CASE 4:
If the month is between 10, 11, and 12, the month is in the fourth quarter.
Enter 10 in the console.
suitable EXAMPLE to display the error. IF USER ENTER INVALID NUMBER OF MONTH.
ENTER 14 IN CONSOLE. IT IS A INVALID NUMBER SO IT DISPLAY ERROR.
Screenshot of full code.
Download