Please show output in python
Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an int to represent the day.
Ex: If the input is:
April 11
the output is:
Spring
In addition, check if the string and int are valid (an actual month and day).
Ex: If the input is:
Blue 65
the output is:
Invalid
The dates for each season are:
Spring: March 20 - June 20
Summer: June 21 - September 21
Autumn: September 22 - December 20
Winter: December 21 - March 19
Answer
Code screenshot
Actual Code
months = input("Enter the name of the
Month(January-December\n")#user input of the month taken and it
stored in months
dm = int(input("Enter the day(1-31\n"))#user input of the day taken
and it stored in dm
if months in ('December', 'January', 'February', 'March'):#checking
conditions to print spring,summer,autumn and winter
if (months == 'March') and (dm > 19):
print('Spring')
else:
print('Winter')
elif months in ('March', 'April', 'May', 'June'):
if (months == 'June') and (dm > 20):
print('Summer')
else:
print('Spring')
elif months in ('June', 'July', 'August', 'September'):
if (months == 'September') and (dm > 21):
print('autumn')
else:
print('summer')
else:
print('Invalid')#if user inputs wrong month and date it will print
invalid
Output(Screenshot)
---
Best of Luck
Tried to write a program as much as simple
if you need any help, please mention it, love to help
Please show output in python Write a program that takes a date as input and outputs...
Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an int to represent the day. Ex: If the input is: April 11 the output is: Spring In addition, check if the string and int are valid (an actual month and day). Ex: If the input is: Blue 65 the output is: Invalid The dates for each season are: Spring: March 20 - June 20 Summer:...
write a program that takes a date as input and outputs the date's season. the input is a string to represent the month and an int to represent the day
2. Implement an application in Java such that if the user enters a month and a day, it should display the name of the season. Design a UI as per your choice. [Hint: The dates for each season are: Spring: March 20 - June 20 Summer: June 21 - September 21 Autumn: September 22 - December 20 Winter: December 21 - March 19]
Create a function that will accept a date as input and will return if this date happens in fall, spring, winter or summer. Before you start writing this function experiment with queries below. Current date select sysdate from dual; Yesterday select sysdate - 1 from dual; Tomorrow select sysdate + 1 from dual; The date format element D returns the number of the day of the week (1-7). select to_char(sysdate,'D') from dual; MM returns two-digit numeric abbreviation of month (01-12;...
Python question: Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0 Output x modulo 2 (remainder is either 0 or 1) Assign x with x divided by 2
Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Quit", "quit", or "q" for the line of text.Ex: If the input is:Hello there Hey quitthen the output is:ereht olleH yeHThere is a mistake in my code I can not find. my output is : ereht olleH ereht olleHyeHHow can I fix this?I saw some people use void or the function reverse but we didnt...
Use R to solve these problems 8. The year is divided into four seasons: spring, summer, fall and winter While the exact dates that the seasons change vary a little bit from year to year because of the way that the calendar is constructed, we will use the following dates for this exercise: Season rin Summer Fall Winter Start March June September December End Ma August November Februa Create a program that reads a month from the user. The user...
1) Write a Python program that prompts the user to enter the current month name and prints the season for that month. Hint: If the user enters March, the output should be "Spring"; if the user enters June, the output should be "Summer". 2 )Write a Python program using the recursive/loop structure to print out an equilateral triangle below (double spacing and one space between any two adjacent asterisks in the same row). * * * * *...
Write a program that takes in a line of text as input, and outputs that line of text in reverse. You may assume that each line of text will not exceed 50 characters. The program repeats, ending when the user enters "Quit", "quit", or "q" for the line of text. Ex: If the input is: Hello there Hey quit then the output is: ereht olleH уен Hint: Use the fgets function to read a string with spaces from the user...
4.24 LAB: Print string in reverse Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Quit", "quit", or 'q" for the line of text. Ex: If the input is: Hello there Hey quit the output is: ereht ollel yeH