Question

In: Computer Science

Based on the following Python code, write a Python statement which outputs “December” when the value...

Based on the following Python code, write a Python statement which outputs “December” when the value of the Month is 12 or “November” when the value of the Month is 11 or “Neither” when value of the Month is neither 11 or 12. The user enters the value which is store in the variable namedMonth.

Month = int(input("Please enter the value of the month in numerical format such as 11 for November, or 12 for December: " ))

sing Python

Solutions

Expert Solution

# PLEASE LIKE THE SOUTION
# FEEL FREE TO DISCUSS IN COMMENT SECTION
# PYTHON PROGRAM

#main method
def main():
   # ask user for input of month
   Month = int(input("Please enter the value of the month in numerical format such as 11 for November, or 12 for December: " ))
  
   # nowcheck for monthvalue and print

   # if 11
   #print("November")

   # if 12
   #print("December")

   # else
   #print("Neither")

   print("November") if Month==11 else (print("December") if Month==12 else print("Neither"))

  
#PrOGrAM EXECUTION STARTS HERE
main()

#SAMPLE OUTPUT


Related Solutions

Write code in Python that does the following : An anagram is when the order of...
Write code in Python that does the following : An anagram is when the order of a word can be changed to create a new word (evil, live, and vile for example). Using the dictionary provided, find all of the anagram groups. Which words contain the most anagrams? How large is this group? Here is another example: Alert, alter, and later have 3 in their group. Use the provided dict.txt as your word list, solution must also finish in less...
Write python code which displays the sales commission based on the total sale and the employee’s...
Write python code which displays the sales commission based on the total sale and the employee’s region, using on the following table. Total Sale Region Commission Under $2,500 East 5% $2,500 or more East 7.5% Under $2,500 West 10% $2,500 or more West 12.5%
code in python write a code where the initial value is compounded by a multiplier, rounded...
code in python write a code where the initial value is compounded by a multiplier, rounded to the nearest tenth Output: Initial Value: 10 Multiplier: 1.4 Number of compounds: 10 Your Values are: 10 , 14, 19.6 , 27.4, 38.4, 53.8, 75.3, 105.4, 147.6, 206.6
In Python Which initial value of x will make the following piece of code leave a...
In Python Which initial value of x will make the following piece of code leave a 9 in the final value of x? x = ____? if x < 7:    x = x + 1 x = x + 2 a. 11 b. 9 c. 7 d. None of the above Which initial value of x will make the following piece of code leave a 20 in the final value of x? x = ____? if x * 2...
PLEASE DO IN C++ AND USE REPL TO WRITE CODE The following problem statement is based...
PLEASE DO IN C++ AND USE REPL TO WRITE CODE The following problem statement is based on a problem in the C++ text by Friedman & Koffman: The results of a survey of the households in your township are available for public scrutiny. Each record (struct-type entity) contains input data for one household, including a four-digit integer identification number the annual income for the household the number of household members. Assuming that no more than 25 households were surveyed, write...
Write a Python code that when the temperature of the CPU in the raspberry pi exceeds...
Write a Python code that when the temperature of the CPU in the raspberry pi exceeds 40 degrees Celsius you receive an email.
IN PYTHON Write a program that takes in a positive integer as input, and outputs a...
IN PYTHON 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 % 2 (remainder is either 0 or 1) x = x // 2 Note: The above algorithm outputs the 0's and 1's in reverse order. You will need to write a second function to reverse the string....
Write a code that takes the initial velocity and angle as an input and outputs the...
Write a code that takes the initial velocity and angle as an input and outputs the maximum height of the projectile and its air time. Follow the pseudo code below. This will not be provided in as much detail in the future so you’ll have to provide pseudocode or a flowchart to showcase your logic. For this first assignment though, the logic is laid out below with some indented more detailed instructions. PROGRAM Trajectory: Establish the User Interface (Typically referred...
Write a program in python that takes a date as input and outputs the date's season....
Write a program in python 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...
Please write in Python code Write a program that stores the following data in a tuple:...
Please write in Python code Write a program that stores the following data in a tuple: 54,76,32,14,29,12,64,97,50,86,43,12 The program needs to display a menu to the user, with the following 4 options: 1 – Display minimum 2 – Display maximum 3 – Display total 4 – Display average 5 – Quit Make your program loop back to this menu until the user chooses option 5. Write code for all 4 other menu choices
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT