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
How do you do this question?
elena55 [62]

Answer:

for (scores.Entry<String, Integer> entry : scores.entrySet()) {

          int value=0; String key="Rambo";

          String k = entry.getKey();

           int v = entry.getValue();

           if (v>value)

           {

               value =v;

           }

           else

           {

               value=value;

           }  

       }

       for( scores.Entry<String, Integer> entry : scores.entrySet())

      {

        if( entry.getValue()==value)            

        System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());

      }

Explanation:

The above scores are an object of Map type.  And this is a parameter of findUopStudent function. So scores is a Map, and entry is an item. And we get its key and value. Now we compare each value using senteniel method and find the maximum value. Now we iterate through the scores using for the look and check the value of each entry against the maximum value found, and we print out the entry with maximum value. And that is the top student, which is required.  

4 0
2 years ago
Write a Python program that inputs an integer between 0 and 1000 and adds all the digits in the integer. For example, if integer
nignag [31]

I've included my code in the picture below.

5 0
3 years ago
Can anyone help me<br> I will make you a brainalist
Ulleksa [173]

Answer:

Explanation:

Exercise A:

1. A table.

2. Categorical.

3. Access.

4.Queries.

5.ACCDB extension.

Exercise B:

1. Insert Tab.

2. DoCmd.Quit method.

3.Navigation Pane.

4. Modify table data.

5.The top pane and the bottom pane.

Hope this helped you!

4 0
2 years ago
_______ allows you to add formatting such as shapes and colors to text. a. worddraw b. wordart c. worddesign d. wordshapes
4vir4ik [10]
Word Design is the answer.
4 0
3 years ago
Read 2 more answers
What is that black thing on my wall?
Darya [45]
I'm guessing your television if it's a flat screen
7 0
2 years ago
Other questions:
  • What are a few benefits of virtualization?<br> How do they benefit ?
    9·1 answer
  • Assume you have a project with seven activities labeled A-G (following). Derive the earliest completion time (or early finish-EF
    15·1 answer
  • What is data protection
    13·1 answer
  • Which process refers to starting up a computer?
    9·2 answers
  • Page UND
    8·1 answer
  • Write a program that uses these bounds and bisection search (for more info check out the Wikipedia page on bisection search) to
    8·1 answer
  • opy the code below into the coderunner window. Debug the code so that it outputs the verses correctly. a = input("Enter an anima
    14·1 answer
  • Mention one application of AI from the real world and describe the use of of this application what is the type of learning used
    11·1 answer
  • Calculate the total and average number from 1 to 100<br>​
    12·1 answer
  • Plzz help me with this question.........
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!