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
Dmitry_Shevchenko [17]
2 years ago
11

How to implement switch statement in Python?

Computers and Technology
2 answers:
gregori [183]2 years ago
8 0
Make sure there is a function/method to handle the default case. Next, make a dictionary object and store each of the function beginning with the 0th index. After that, write a switch() function accepting the day of the week as an argument.
Jet001 [13]2 years ago
5 0

Answer:

Switch-case statements are a powerful tool for control in programming. In this article, Sreeram Sceenivasan goes over you can use a switch-case statement in Python.

Explanation:

Python doesn’t need a switch statement. You can do exactly the same thing with if/elif/else statements.

You might be interested in
Although heart rate increases and decrease depending upon activity level on average a typical person heart rate is about _____ b
ExtremeBDS [4]

Answer:

72

The normal resting heart rate is between 70 and 100 bpm.

4 0
3 years ago
. Electricians will sometimes call ______ "disconnects" or a "disconnecting means."
arlik [135]

Answer: A: Switches

Explanation:

6 0
3 years ago
Question 11
STatiana [176]

What type of program would have a class named Student with objects called fullTime and partTime?

A. machine language program

B. object-oriented program

C. markup language program

D. procedural language program

Answer:

B. object-oriented program

Explanation:

An object-oriented program or OOP is a type of program that uses the concepts of objects and methods.

Although they are quite broad, they also make use of classes and types.

Java, for instance makes use of OOP as they use classes and objects under those classes and name them anyhow they want.

Therefore, the correct answer is B

8 0
3 years ago
Write a program that accepts three decimal numbers as input and outputs their sum​
Sophie [7]

Answer:

sum = 0.0

for i in range(0,3):

   sum += float(input("Enter a decimal number to sum: "))

print ("Sum: ", sum)

*** Sample Input ***

Enter a decimal number to sum: 1.1

Enter a decimal number to sum: 2.2

Enter a decimal number to sum: 3.3

*** Sample Output ***

Sum:  6.6

Explanation:

For this problem, a method was devised in python to create the sum of three individual decimal numbers.

The first line of code, <em>sum = 0.0</em>, initializes a variable to the float type in which we will store the value of our sum.  Note, it is initialized to 0.0 to start from a value of 0 and be considered a float.

The second line of code, <em>for i in range(0,3):</em>  is the creation of a for loop control structure.  This will allow us to repeat a process 3 amount of times using the iterator i, from value 0 to 3 in this case.  Note, 0 is inclusive and 3 is exclusive in the python range.  This means the for loop will iterate with, i=0, i=1, and i=2.

The third line of code, <em>sum += float(input("Enter a decimal number to sum: "))</em>  is simply asking the user for a number, taking that input and converting it from a string into a float, and then summing the value with the previous value of sum and saving that into sum.

The fourth line of code, <em>print ("Sum: ", sum)</em> is simply displaying the final value that was calculated by adding the three user inputs together which were stored into the variable <em>sum</em>.

Cheers.

6 0
2 years ago
Read 2 more answers
What is a nonlinear presentation?
TEA [102]
The answer is A. For example, you could start at slide 8 and jump to slide 2 and then to 3. It does not follow and linear structure!!
8 0
3 years ago
Read 2 more answers
Other questions:
  • What is the primary purpose for a screen saver in windows?
    8·1 answer
  • ____ are systems in which queues of objects are waiting to be served by various servers
    5·1 answer
  • How long does it take to wire a house?
    14·2 answers
  • Round-robin schedulers normally maintain a list of all runnable processes, with each process occurring exactly once in the list.
    14·1 answer
  • What is secondary exchange ? - Apex
    14·1 answer
  • What should be included as part of the approval process? in relation to computer forensics
    14·1 answer
  • What does it mean when your check engine light comes on?
    7·1 answer
  • You have just connected a new computer to your network. The network user static IP addressing. You find that the computer can co
    12·2 answers
  • Porque es importante la tecnología?​
    8·1 answer
  • You are the security analyst for your organization and have discovered evidence that someone is attempting to brute-force the ro
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!