1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vanyuwa [196]
3 years ago
11

Write a program named CheckMonth that prompts a user to enter a birth month. If the value entered is greater than 12 or less tha

n 1, display the error message Invalid month; otherwise, display the valid month with a message such as 3 is a valid month.
Computers and Technology
1 answer:
klemol [59]3 years ago
3 0

Answer:

Program:

month=['January', 'Februrary', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] #list which stores the name of the month.

CheckMonth= int(input("Enter the number of the month")) #it is used to take the inputs from the user.

if CheckMonth>=1 and CheckMonth<=12: #check the condition for valid month.

   print(str(CheckMonth)+" is a valid month which name is: "+ str (month [CheckMonth-1])) #print the name of month which is enter by the user.

else:

   print(str(CheckMonth)+" is not a valid month, please enter the valid month") # print for the invalid month.

Output:

  • If the user inputs 1, it will prints "1 is a valid month which name is: January".
  • If the user inputs is 0, then it will prints "0 is not a valid month, please enter the valid month"

Explanation:

  • The above program is in python language, in which the first line of the code is used to hold the list of the month.
  • Then the second line is used to render a message for the user input, take the input from the user and save it into a variable.
  • Then that value is checked by the if-condition that it lies in between 1 to 12 or not.
  • If it lies, then print the valid month otherwise it prints that the month is invalid.
You might be interested in
Intranet giving unlimited information <br><br>True<br><br>False​
leva [86]

Answer:

true

Explanation:

An intranet is a computer network for sharing information, collaboration tools, operational systems, and other computing services within an organization, usually to the exclusion of access by outsiders. ... Intranets can also be used to facilitate working in groups or via teleconferences.

7 0
2 years ago
A bowl contains 20 candies; 15 are chocolate and 5 are vanilla. You select 5 at random. What is the probability that all 5 are c
Sindrei [870]

Answer: 0.1937

Explanation:

Given : A bowl contains 20 candies; 15 are chocolate and 5 are vanilla.

If we select 5 candies, then the number of ways to select them is given by permutations.

The number of ways to select 5 candies is given by :-

^{15}P_5=\dfrac{15!}{(15-5)!}=\dfrac{15\times14\times13\times12\times11\times10!}{10!}=360360

The number of ways of selecting any 5 candies out of 20:-

^{20}P_5=\dfrac{20!}{(20-5)!}\\\\=\dfrac{20\times19\times18\times17\times16\times15!}{15!}\\\\=1860480

Now, the probability that all 5 are chocolate :-

=\dfrac{360360}{1860480}=0.193691950464\approx0.1937

Hence, the probability that all 5 are chocolate =0.1937

5 0
3 years ago
Read 2 more answers
Fill in the blank: In a Word chart, text that describes the data represented in a chart and that is typically displayed on the r
Triss [41]

Answer:

Data bar

Explanation:

8 0
3 years ago
How to disable iCloud music library? When I go into settings or music or even iTunes the iCloud music library switch doesn’t pop
Komok [63]
It may be a glitch in the settings, or it may a parental block
8 0
2 years ago
Consider the following scenario. The Current State of One Particular ArrayList The capacity of a particular ArrayList is five (5
pshichka [43]

Answer:

The ArrayList initial functionality is 5, there were 4 components.

Then, add 25 more elements by using add()calling 25 times So total number of elements after the completed operation would be 4 + 25= 29.

5th component will be introduced without calling ensureCapacity(); while adding 6th element-> ensureCapacity(2* 5+ 1) it will call, making the capacity 11.

So ArrayList's capacity will be 11.

Next 7th to 11th components will also be added automatically once the 12th element is added, it will name ensureCapacity(2* 11+ 1) and make the capacity 23.

While adding 24th dimension, ensureCapacity(2* 23+ 1) will be called again and this will make the capacity 47.

There will therefore be 3 (three) calls to ensure the feature Ability).  

Elements of Rest 25th to 29th will be added seamlessly as ability becomes 47.

3 0
3 years ago
Other questions:
  • Why were mechanical calculators developed?
    8·2 answers
  • A database interrogation is a major benefit of the database management approach, where end users can query (“ask”) the database
    6·1 answer
  • Why is it not advisable to mark tlc plates with a pen to indicate?
    12·1 answer
  • laire writes a letter to her grandmother, in which she describes an amusement park she visited last week. She adds pictures of t
    11·1 answer
  • The architecture that the large paper company Mohawk adopted enables the company to scale technology services up and down instan
    14·1 answer
  • If your computer has a ________, someone else can gain access to it undetected.
    10·1 answer
  • The readline method reads text until an end of line symbol is encountered, how is an end of line character represented
    14·1 answer
  • HELP PLEASE
    7·1 answer
  • You have imported a library with the birthMonth() function. Based on the API, how many strings are inputed to calculate the birt
    11·1 answer
  • The element of website design that refers to the website's aesthetic appeal and the functional look and feel of the site's layou
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!