subject
Computers and Technology, 26.02.2021 18:10 caeley

Can you please look through this code and see wants wrong with it? its in python
# FirstFunction #
# #
# UTeach CSP #
# Brian Ford #
# edited by Shaun rigglelman #
# 11/12/19 #
# #


import random
import math

#this should Calculate your body mass index
def Calculate_BMI () :
name = input("Please type your name: ")
height = float(input("How many inches tall are you: "))
nheight = height / 39.37
weight = float(input("How much do you weigh (in pounds): "))
nweight = weight / 2.205
bmi = nweight / (nheight * nheight)
print(name + ", your BMI is " + str(bmi))

#this is an number game which you try and guess a number 1 to 100 it repeats until you guess right then it says the number of trys it took you
def number_game () :
count = 1
randnum = random. randint(1, 100)
print("I am thinking of a number between 1 and 100.")
guess = int(input("What number am I thinking of? "))
while guess != randnum:
if guess < randnum:
guess = int(input("Too low, guess again: "))
else:
guess = int(input("Too high, guess again: "))
count = count + 1
print("You guessed correctly, it took you " + str(count) + " tries.")

#this part of the program asks for your grades then askes what grade you will like then it does some math and tells you want grade you will need on your EOG (or EOC) final
def final_exam () :
mp1 = int(input("What was your grade for marking period 1? "))
mp2 = int(input("What was your grade for marking period 2? "))
grade = int(input("What grade would you like to have for your overall semester grade? "))
score = (grade - mp1 * 0.4 - mp2 * 0.4) / 0.2
print("You will need to score a " + str(score) + " on the final exam.")

#this last part is just a basic calculator like it says it only does adding, Subtracting, Multipling, and dividing
def calculator () :
num1 = float(input("Enter your first number: "))
num2 = float(input("Enter your second number: "))
operator = input("Which operation do you want to perform?\nAdd \nSubtract \nMultiply \nDivide\n")
if operator == "Add":
solution = num1 + num2
print("You answer is: " + str(solution))
elif operator == "Subtract":
solution = num1 - num2
print("You answer is: " + str(solution))
elif operator == "Multiply":
solution = num1 * num2
print("You answer is: " + str(solution))
elif operator == "Divide":
solution = num1 / num2
print("You answer is: " + str(solution))
else:
print("Incorrect math operation. Oof.")
else:
print("That is an incorrect option.")

choice = int(input("""Which of the following would you like to do? Type the number corresponding to the choice.
1) Calculate BMI
2) Play a Game
3) Final Exam - What do I need if...
4) Basic Calculator
"""))

if choice == 1:
Calculate_BMI
elif choice == 2:
number_game
elif choice == 3:
final_exam
elif choice == 4:
calculator

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 17:00, norsenorma
In addition to using the icons to adjust page margins, a user can also use
Answers: 1
image
Computers and Technology, 21.06.2019 19:40, queenskyyt
Write the quartstogallons java class that declares a named constant to hold the number of quarts in a gallon (4). also declare a variable to represent the number of quarts needed for a painting job, and assign an appropriate value—for example, 18. compute and display the number of gallons and quarts needed for the job. display explanatory text with the values, for example:
Answers: 2
image
Computers and Technology, 22.06.2019 10:00, hailee232
What is a society that has moved to the internet rather than relying on physical media called
Answers: 2
image
Computers and Technology, 24.06.2019 06:30, titalili0204
Adrawing that places all lines parallel to the z axis at an angle from the horizon is 99 ! a. an oblique drawing b. a perspective drawing c. an auxiliary view d. a one-point perspective drawing
Answers: 2
You know the right answer?
Can you please look through this code and see wants wrong with it? its in python
# FirstFunc...

Questions in other subjects:

Konu
Mathematics, 05.05.2020 01:38