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]
3 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]3 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
Which of the following gives the
satela [25.4K]

Answer:

a. Competitive advantage

7 0
3 years ago
Read 2 more answers
Which of the columns (A) to (I) in the truth table below is correct for the expression
bazaltina [42]

Answer:

tftftftftftftftftftftftftftftftftftftftftftftftftftftttttftfffftftftftttttfftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftfttftftftftftftftftftftftftftftftftftftftftftftftfttftftftfttfftftftftftftftftftftftftftfttttttttttttttttttttttfffffffffffffffffffftftftfttttttttftftftftftftftftftftftftftftftftftftftftfttftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftfftftftftftftftftfttftftftftftftftftftftftfftftftffftftfftfftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftfftfftftftftftftftftftftftftfftftftftftftftftftftftfftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftfftftftffftftftfftftftftftftftfftftftftftftftftftftftftftftftftfttftftftftftgtftftgtftgtftgtftgtftfftftfftfftfftfftftftftftftftftftftftftftftftftftftftftftfftftftftftftftftftftftftftftftfftfftfftftftftfttfftftftftftftftfftftftftftftftftftftftftftftftftftftftftftftftffftftftftftftftftftftftftftftftfftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftftfftftftftftftftftftftftftftftftftfftfftftftftftftftftftftftfftftfftftftftfftftfftftftfftftftftftftftfftftttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt

7 0
3 years ago
Read 2 more answers
Ites and days, on one of the slides in her school presentation. Which element can she use to
Lady_Fox [76]
<h2>Answer:</h2><h3>A text</h3><h3>or</h3><h3>C chart</h3>

8 0
3 years ago
Read 2 more answers
Do you think social media should affect presidential elections
Rina8888 [55]

No, not really cuz I think that would be too personal for the president.

5 0
3 years ago
Read 2 more answers
Pleaseeee Help.
Elenna [48]

Answer:B

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • Which is the last step in conducting a url research
    11·1 answer
  • Witch word in the sentence is a noun? the food he is cooking smells delicious.
    7·1 answer
  • Uploading is the process of transferring existing content stored on a server or other computer or device to your device via a ne
    8·1 answer
  • Who is involved in helping shape the emotional impact of a film? (Select all that apply.)
    8·2 answers
  • How do u make a bored builder
    8·2 answers
  • What error occurs in the following program? #include using namespace std; int main() { int number1, number2, sum; cout &lt;&lt;
    13·1 answer
  • Describe the features of agile modeling​
    5·1 answer
  • B) Describe the computer processing that is required to maintain the correct growing<br>conditions.​
    13·1 answer
  • I'm pretty sure most of you know squid game, right? Well, are the actors really dying? or is it just CGI or effects? Because it'
    5·2 answers
  • Question 2:
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!