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
Sauron [17]
3 years ago
7

On a roulette wheel, the pockets are numbered from 0 to 36. The colors of the pockets are as follows: Pocket 0 is green. For poc

kets 1 through 10, the odd-numbered pockets are red and the even-numbered pockets are black. For pockets 11 through 18, the odd-numbered pockets are black and the even-numbered pockets are red. For pockets 19 through 28, the odd-numbered pockets are red and the even-numbered pockets are black. For pockets 29 through 36, the odd-numbered pockets are black and the even-numbered pockets are red. Write a program that asks the user to enter a pocket number and displays whether the pocket is green, red, or black. The program should display an error message if the user enters a number that is outside the range of 0 through 36.
Computers and Technology
1 answer:
Rama09 [41]3 years ago
6 0

Answer:

pkt = int(input("Pocket Number: "))

if pkt == 0:

   print("Green")

elif pkt >= 1 and pkt <=10:

   if pkt%2 == 0:

       print("Black")

   else:

       print("Red")

elif pkt >= 11 and pkt <=18:

   if pkt%2 == 0:

       print("Red")

   else:

       print("Black")

elif pkt >= 19 and pkt <=28:

   if pkt%2 == 0:

       print("Black")

   else:

       print("Red")

elif pkt >= 29 and pkt <=36:

   if pkt%2 == 0:

       print("Red")

   else:

       print("Black")

else:

   print("Error")

Explanation:

The program was written in Python and the line by line explanation is as follows;

This prompts user for pocket number

pkt = int(input("Pocket Number: "))

This prints green if the pocket number is 0

<em>if pkt == 0:</em>

<em>    print("Green")</em>

If pocket number is between 1 and 10 (inclusive)

elif pkt >= 1 and pkt <=10:

This prints black if packet number is even

<em>    if pkt%2 == 0:</em>

<em>        print("Black")</em>

Prints red, if otherwise

<em>    else:</em>

<em>        print("Red")</em>

If pocket number is between 11 and 18 (inclusive)

elif pkt >= 11 and pkt <=18:

This prints red if packet number is even

<em>    if pkt%2 == 0:</em>

<em>        print("Red")</em>

Prints black, if otherwise

<em>    else:</em>

<em>        print("Black")</em>

If pocket number is between 19 and 28 (inclusive)

elif pkt >= 19 and pkt <=28:

This prints black if packet number is even

<em>    if pkt%2 == 0:</em>

<em>        print("Black")</em>

Prints red, if otherwise

<em>    else:</em>

<em>        print("Red")</em>

If pocket number is between 29 and 36 (inclusive)

elif pkt >= 29 and pkt <=36:

This prints red if packet number is even

<em>    if pkt%2 == 0:</em>

<em>        print("Red")</em>

Prints black, if otherwise

<em>    else:</em>

<em>        print("Black")</em>

Prints error if input is out of range

<em>else:</em>

<em>    print("Error")</em>

You might be interested in
Use the drop-down menus to complete each sentence.
gizmo_the_mogwai [7]

Answer:1 3 and 5 is Columns and 2 4 and 6 is Rows theres your answer.

Explanation: its self explanatory.

3 0
2 years ago
Read 2 more answers
The field that uses technology to manipulate and use information to improve healthcare is known as:_______
Sergeu [11.5K]

Answer:

Health informatics

Explanation:

7 0
1 year ago
Write the following arithmetic expression as a valid C arithmetic expression: x = x + number
otez555 [7]

Answer:

x = x + number

x+=number

Explanation:

Given

x = x + number

Required

Write an equivalent expression in C

The given expression uses + and + is represented as + in C

So: The equivalent expression is

x = x + number

However, C supports compound assignment operators

So:

x = x + number

can be rewritten as

x+=number

3 0
3 years ago
Henry has created a software product that manages a database of company clients. He wants to install the software on a client's
UkoKoshka [18]

Answer:

The answer is " Run the software on the original web browser practically".

Explanation:

The Virtual servers enable you to run programming not programmed to the devices. Let's all presume which Henry's software will operate on computers but not on the mac. Since Mac is unable to run this software, it can practically install Linux on MC and install this.

  • The several common software applications such as parallels, VMware, and Virtual machines could be practically used during mac to install windows.
  • Its platform operating system from a macOS software perspective is a true physical computer with almost everything set.
5 0
2 years ago
End users have complained that when they click a link on your company's Website, the wrong client loads. You review the page wit
Ilia_Sergeevich [38]

Answer:

4. A Web server has been specified.

Explanation:

End users have complained that when they click a link on your company's Website, the wrong client loads. You review the page with the suspect link and find the following HTML code:

To begin an FTP session, click the following link:

FTP Session

The problem is that Web server has been specified.

7 0
3 years ago
Other questions:
  • 50+ POINTS AND BRAIN IF CORRECT Chris is working with other employees on a worksheet. The other employees have made comments, bu
    8·1 answer
  • In addition to training on the products and on company policy, it does not make sense to be prepared to speak about your company
    6·2 answers
  • What is FireWire?
    7·2 answers
  • All of the following activities may infect your computer with a virus EXCEPT ________.
    6·1 answer
  • (Game Design) A float is a blank space, used as a placeholder in an array<br><br> True or false
    13·1 answer
  • Lucy wants to develop a web page to display her profile. She wants to just start with a basic page that lists her accomplishment
    13·1 answer
  • In this section of your final project, you will write a basic script to create and back up files. You will create this script wi
    11·2 answers
  • A short-range wireless network is called:
    10·1 answer
  • Which of the following number is divisible by 3? (340 , 432 , 113)​
    7·1 answer
  • In what way, if any, is the impact of a given risk affected by the timing of a project?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!