Question

In: Computer Science

Write a code on Jupytor notebook: On a roulette wheel, the pockets are numbered from 0...

Write a code on Jupytor notebook:

  1. 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 pockets 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.

  1. To enter the Zicklin school of business, students need to complete at least 45 credits with an overall Baruch GPA of 2.25 or higher. Ask the user the number of credits they have completed and their overall GPA and display whether they are eligible to get into Zicklin or not.

3. Check the Baruch/CUNY Pathways requirements for college option – http://www.baruch.cuny.edu/genedreqs/pathwaysatbaruch/pathwaysoptions_baruch.htm. Ask the user the right questions and do the right checks to display the coursework that the user needs to complete.

4. Calculate BMI for user provided weight and height and display an interpretation of the BMI.

Solutions

Expert Solution

I have provided well-commented code to all the questions, most of them are if-else blocks and pretty self-explanatory.

1. The well-commented code is as follows:

Sample output:

2.

Sample output for the other case:

3. The code for the following is, please excuse me if i missed some cases, this question was a bit vague. but if you face any issue comment it, i will surely help you.


4.

if the answer helped you, please upvote and in case of any doubts please comment, i will surely help.

Code:

1.

# x is the input integer given by the user
x = int (input("Enter an integer: "))
if (x<0 or x >36) :
print("The number should be in the range 0 to 36")
elif(x==0):
print("The pocket is GREEN")
elif((x>=1 and x<=10)or(x>=19 and x<=28)):
if(x%2):
print("The pocket is RED")
else :
print("The pocket is BLACK")
else: # the remaining numbers will be between (11 to 18) and (29 to 36) in this else condition
if(x%2):
print("The pocket is BLACK")
else:
print("The pocket is RED")

2.

# credit stores the total credit scored by the student
# gpa variable stores the overall BAruch GPA of the student
credit = int(input("Enter the number of credits that you have completed: "))
gpa = float(input("Enter your overall GPA: "))

if(credit>=45 and gpa>=2.25):   
# condition that student's credit is greater than equal to 45 and overall gpa>= 2.25
print("Eligible to enter Zicklin")
else:
print("Not Eligible to enter Zicklin")

3.

# Select the type of oursework the student has completed at another institution.
print("Which of the following are you?")
print("1. Students transferring from an Associate Degree Program to Baruch")
print("2. Students transferring from a CUNY Bachelor’s Degree Program to Baruch")
print("3. Students transferring from a Non-CUNY Bachelor’s Degree Program to Baruch")
print("4. Second Bachelor’s Degree Students")
print("5. Students who transfer multiple times")

userType = int(input())
# take the user COTP score
COTP = int(input("Enter your COTP credits: "))

# For every type of user we create a seperate if-else block
if userType == 1:
# the first user can be of three types
print("Which of the following categories are you from?")
print("1. Earned Associate Degree")
print("2. Earned More than 30 credits")
print("3. Earned 30 or Fewer credits")
# we select the type of user amongst the three categories
category = int(input())
# if the user has enough credits then we show he is eligible
# otherwise we show the extra credits that he needs
# and we do the same for all other types of previous education
if category == 1:
if(COTP >= 6):
print("You are eligible")
else:
print(f"You need {6-COTP} more COTP credit")
elif category == 2:
if(COTP >= 9):
print("You are eligible")
else:
print(f"You need {9-COTP} more COTP credit")
elif category == 3:
if(COTP >= 12):
print("You are eligible")
else:
print(f"You need {12-COTP} more COTP credit")
  
elif userType == 2:
if(COTP >= 12):
print("You are eligible")
else:
print(f"You need {12-COTP} more COTP credit")
  
elif userType == 3:
if(COTP >= 12):
print("You are eligible")
else:
print(f"You need {12-COTP} more COTP credit")
  
elif userType == 4:
print("You are eligible")

else:
print("Which of the following categories are you from?")
print("1. Began college in associate program")
print("2. Began college in baccalaureate program")
category = int(input())
if category == 1:
if(COTP >= 6):
print("You are eligible")
else:
print(f"You need {6-COTP} more COTP credit")
elif category == 2:
if(COTP >= 12):
print("You are eligible")
else:
print(f"You need {12-COTP} more COTP credit")

4.

height = float(input("Enter your height in centimeter"))
weight = float(input("Enter your weight in kilograms"))

# converting height into meters from centimeters
height=height/100

# bmi is the variable to store the calculated BMI of the user
bmi = weight/(height*height) # metric BMI calculation formula

print("User's BMI is ", bmi)

print("According to your BMI:- ")
if(bmi<18.5):
print("You are Underweight")
elif(bmi>=18.5 and bmi<25.0):
print("You are Healthy")
elif(bmi>=25.0 and bmi<30.0):
print("You are Overweight")
else:
print("You are Obese")


Related Solutions

On a roulette wheel, the pockets are numbered from 0 to 36. The colours of the...
On a roulette wheel, the pockets are numbered from 0 to 36. The colours of the pockets are as follows: • Pocket 0 is green. • For pockets 1 through 10, the odd-numbered pocketsare red and the even-numberedpockets are black. • For pockets 11 through 18, the odd-numberedpocketsare black and the even-numbered pockets are red. • For pockets 19 through 28, the odd-numberedpocketsare red and the even-numberedpockets are black. • For pockets 29 through 36, the odd-numberedpocketsare black and the...
4. On a roulette wheel, the pockets are numbered from 0 to 36. The colours of...
4. On a roulette wheel, the pockets are numbered from 0 to 36. The colours of the pockets are as follows: • Pocket 0 is green. • For pockets 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...
A roulette wheel has 38 slots, numbered 0, 00, and 1 to 36. The slots 0...
A roulette wheel has 38 slots, numbered 0, 00, and 1 to 36. The slots 0 and 00 are colored green, 18 of the others are red, and 18 are black.The dealer spins the wheel and at the same time rolls a small ball along the wheel in the opposite direction. The wheel is carefully balanced so that the ball is equally likely to land in any slot when the wheel slows. Gamblers can bet on various combinations of numbers...
In the game of​ roulette, a wheel consists of 38 slots numbered​ 0, 00,​ 1, 2,...,...
In the game of​ roulette, a wheel consists of 38 slots numbered​ 0, 00,​ 1, 2,..., 36. To play the​ game, a metal ball is spun around the wheel and is allowed to fall into one of the numbered slots. If the number of the slot the ball falls into matches the number you​ selected, you win​ $35; otherwise you lose​ $1. Complete parts ​(a) through ​(g) below (a) Construct a probability distribution for the random variable​ X, the winnings...
You are playing a version of the roulette game, where the pockets are from 0 to...
You are playing a version of the roulette game, where the pockets are from 0 to 10 and even numbers are red and odd numbers are black (0 is green). You spin 3 times and add up the values you see. What is the probability that you get a total of 15 given on the first spin you spin a 2? What about a 3? Solve by simulation and analytically.
In the game of roulette, there is a wheel with 37 slots numbered with the integers...
In the game of roulette, there is a wheel with 37 slots numbered with the integers from 0 to 36, inclusive. A player bets $3 and chooses a number. The wheel is spun and a ball rolls on the wheel. If the ball lands in the slot showing the chosen number, the player receives $3 plus 100$. Otherwise, the player loses the $3 bet. Assume that all numbers are equally likely. Determine the variance of the gain or loss per...
In the popular American game of roulette, the roulette wheel has 38 spaces that are numbered...
In the popular American game of roulette, the roulette wheel has 38 spaces that are numbered 0, 00, and 1 through 36, 0. Find the probability of getting the following: a) A number that is less than 15, not counting 0 and 00; b) A number that is a multiple of 3 or 5, not counting 0 and 00; c) An odd number that is less than 15, not counting 0 and 00; d) A number that is between 1...
A roulette wheel is divided into 38 labeled pockets, 18 of which are red, 18 are...
A roulette wheel is divided into 38 labeled pockets, 18 of which are red, 18 are black, and 2 are green. Each round, you can place a $1 bet on one specific red or black pocket with odds of 35 : 1. That is, if you are correct you receive $35 in addition to the dollar you bet, and if you are incorrect, you get nothing. Your friend has developed what he describes as a “foolproof system” for winning. It...
ROULETTE is a casino game where a numbered wheel spins and a steel ball falls into...
ROULETTE is a casino game where a numbered wheel spins and a steel ball falls into a location marked by one particular colored number. In the United States there are 18 locations colored red, 18 locations colored black and 2 locations colored green. The red and black locations are numbered 1-36 and the green locations are labeled "0" and "00" as shown in the picture to the right. The wheel therefore has 38 locations in total. Note that the odd...
ROULETTE is a casino game where a numbered wheel spins and a steel ball falls into...
ROULETTE is a casino game where a numbered wheel spins and a steel ball falls into a location marked by one particular colored number. In the United States there are 18 locations colored red, 18 locations colored black and 2 locations colored green. The red and black locations are numbered 1-36 and the green locations are labeled "0" and "00" as shown in the picture to the right. The wheel therefore has 38 locations in total. Note that the odd...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT