answer.
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
vlabodo [156]
2 years ago
4

Write a program that asks the user for a number in the range of 1 through 7. The program should display the corresponding day of

the week, where 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday, and 7 = Sunday. The program should display an error message if the user enters a number that is outside the range of 1 through 7. g
Computers and Technology
1 answer:
noname [10]2 years ago
8 0

Answer:

Explanation:

The result structure that we are to use to arrange this program needs to have the ability to differentiate paths depending on way of 8 different inputs that is given (one for every day of the week and another one incase the input is outside the range it's supposed to be in). A group of nested “if” statements should work but would be horribly complicated in looking. A much more innovative approach is to use an if - elif - else structure:

user_input = input('Enter a number: ')

if user_input == '1':

    print(user_input, '= Monday')

elif user_input == '2':

    print(user_input, '= Tuesday')

elif user_input == '3':

    print(user_input, '= Wednesday')

elif user_input == '4':

    print(user_input, '= Thursday')

elif user_input==  '5':

    print(user_input, '= Friday')

elif user_input==  '6':

    print(user_input, '=Saturday')

elif user_input == '7':

    print(user_input, '=Sunday')

else:

    print('Error: That number doesn\'t correspond to a day of the week.')

You might be interested in
What are common names for some primary discrete components used on circuit boards?
Alenkinab [10]
Transistor, resistor, capacitor, inductor, integrated circuit
7 0
2 years ago
Which are examples of copyrighted online materials? Check all that apply.
Stella [2.4K]
The answers are 1, 3, and 5.
7 0
2 years ago
Read 2 more answers
Will mark brainliest if correct. First come, first serve.
VladimirAG [237]

Answer:

Low sampling rate and low bit depth are the right options.

Explanation:

The low sampling rate and low bit depth can ensure less memory consumption. The musician here wants to record some initial ideas for some new song. And she is not concerned about the quality of the audio file she is going to send. And she wishes to send the size of the file that is as small as possible so that it can be quite easily downloaded by her bandmate. She can thus afford a low sampling rate and low bit depth, as the quality is not that important. And a low sampling rate and low bit depth can ensure less memory. Hence, these are the correct options here.

4 0
2 years ago
Use the AND function with appropriate arguments in cell H11 to determine if there is a force out at third base. There is a force
Pie

Answer:

=AND($C11 = "Yes", $D11 = "Yes")

Explanation:

The AND function takes conditional inputs and tests if each of them are TRUE. If all of the inputs are TRUE, the function will output TRUE but if any one of them are not the function will output FALSE. This scales to multiple inputs but this example only has two conditions. It is important to remember that we want to compare a string so our condition must be "Yes", not just Yes.

We also use a relative cell reference, "$", on the columns C and D since we always want to use the "Runner on 1st" and "Runner on 2nd" columns.

6 0
2 years ago
Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the input is: 3 8 the output is
Misha Larkins [42]

Answer:

The program to this question can be given as:

Program:

def swap_values(user_val1, user_val2):  #define function

   return (user_val2, user_val1) #return values

if __name__ == '__main__': #define constructor.

   n1 = int(input('Enter first number :')) #input value form user

   n2 = int(input('Enter second number :')) #input value form user

   (n1,n2) = swap_values(n1,n2) #hold function values.

   print(n1) #print values

   print(n2) #print values

Output:

Enter first number :3

Enter second number :8

8

3

Explanation:

The explanation of the above python program can be given as:

  • In the python program we define a function that is "swap_values". This function takes two integer values that is "user_val1 and user_val2" as a parameters and returns variable values that is "user_val2 and user_val1".
  • Then we use a constructor in this we define two variable that is "n1 and n2" these variable are use to take user-input from the user and pass the value into the function.  
  • To hold the value of the function we use n1 and n2 variable and print these variable value.
4 0
2 years ago
Other questions:
  • Computer hardware had been designed to run a single operating system and a single app, leaving computers vastly underutilized. o
    15·1 answer
  • Jail and prison officials may generally limit inmate rights when the limitations serve
    13·2 answers
  • An online game is played with two dice. In this context, explain what is meant by decomposition in a simple way.
    15·1 answer
  • Which of the following describes ETL? a) A process that transforms information using a common set of enterprise definitions b) A
    14·1 answer
  • Suppose that you need to maintain a collection of data whose contents are fixed- i.e., you need to search for and retrieve exist
    8·1 answer
  • Assume there is a class AirConditioner that supports the following behaviors: turning the air conditioner on and off. The follow
    7·1 answer
  • What is the name of the program file that you can enter in the Windows search or Run box to execute Event Viewer? What process i
    12·1 answer
  • In the lab, you discovered that the server you scanned (10.20.1.2) was vulnerable to the WannaCry ransomeware attack. What ports
    15·1 answer
  • Given a sorted list of integers, output the middle integer. A negative number indicates the end of the input (the negative numbe
    13·1 answer
  • What should businesses do in order to remain competitive under the current Cloud<br> landscape?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!