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
taurus [48]
2 years ago
5

Write a program that would determine the day number in a non-leap year. For example, in a non-leap year, the day number for Dec

31 is 365; for Jan 1 is 1, and for February 1 is 32. This program will ask the user to input day and month values. Then it will display the day number day number corresponding to the day and month values entered assuming a non-leap year. (See part II to this exercise below).
Computers and Technology
1 answer:
SOVA2 [1]2 years ago
7 0

Answer:

In Python:

months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]

daymonths = [31,28,31,30,31,30,31,31,30,31,30,31]

day = int(input("Day: "))

month = input("Month: ")

ind = months.index(month)

   

numday = 0

for i in range(ind):

   numday+=daymonths[i]

numday+=day

print(numday)    

Explanation:

This initializes the months to a list

months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]

This initializes the corresponding days of each month to a list

daymonths = [31,28,31,30,31,30,31,31,30,31,30,31]

This gets the day from the user

day = int(input("Day: "))

This gets the month from the user

month = input("Month: ")

This gets the index of the month entered by the user

ind = months.index(month)

This initializes the sum of days to 0

numday = 0

This adds up the days of the months before the month entered by the user

<em>for i in range(ind):</em>

<em>    numday+=daymonths[i]</em>

This adds the day number to the sum of the months

numday+=day

This prints  the required number of days

print(numday)    

<em>Note that: Error checking is not done in this program</em>

You might be interested in
What is the purpose of a mail merge field.
coldgirl [10]

adding merge fields is a way to personalize a document with information from the data source. The merge fields come from the column headings in the data source.

:)

3 0
3 years ago
What can a user do using the Contact Group dialog box? Check all that apply.
RSB [31]

Answer:

1,2,4,5,7

Explanation:

Had the question

3 0
2 years ago
Read 2 more answers
You enter information by keying it into the??​
Greeley [361]

Answer:

password and username

Explanation:

3 0
2 years ago
Read 2 more answers
When creating a storyboard, in which section do you mention how you move from one shot to the next?
tekilochka [14]

Answer: C

Explanation:

7 0
2 years ago
Discussion Topic:
hodyreva [135]

Answer:

Prevents lagging

Explanation:

This prevents the website from being slow and upto shape so those who access it dont have difficulties

7 0
1 year ago
Other questions:
  • Shania has started a new job as an app developer. Her first task was to make an old app designed for Android available on other
    6·1 answer
  • Give a pseudo-code description of the O(n)-time algorithm for computing the power function p(x,n).Also draw the trace of computi
    5·1 answer
  • Help, please!! A file named "games.txt" exists and has 80 lines of data. You open the file with the following line of code. aFil
    6·1 answer
  • Operational feasibility, which refers to user acceptance and support, as well as management acceptance and support, is also know
    9·1 answer
  • Which of the following hacker attacks against wireless networks are virtually undetectable?
    12·1 answer
  • Note: the println() function prints out a line of text with the value that you pass to it - so if you say println("Hi"), it will
    5·1 answer
  • 1. Pasar los siguientes ejercicios a diagrama de bloque
    11·1 answer
  • Computer programming 3
    13·1 answer
  • Suggest three ways in which celebrating an occasion influences food choices?
    10·2 answers
  • What can be done to solve unemployment problem?​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!