Question

In: Computer Science

Post a Python program that accepts at least three values as input, performs some computation, and...

Post a Python program that accepts at least three values as input, performs some computation, and displays at least two values as the result. The program must include an if statement that performs different computations based on the value of one of the inputs. Include comments in your program that describe what the program does. I would like to see a program that is simple like BMI calculator or any other program that can be used in a real-life situation like budgeting or tile/flooring installation etc thanks.

Solutions

Expert Solution

CODE

print("\nBMI CALCULATOR")
# reading inputs age, height, weight from user
age = int(input("Enter age: "))
height = float(input("Enter height(in metres): "))
weight = float(input("Enter weight(in Kg): "))

# checking if age is greater than or equal to 18
if(age >= 18):
        # if yes
        # calculating bmi value
        bmi = weight / height ** 2
        # checking the bmi range for calculated bmi value
        # if bmi less than 18.5, then Underweight
        if(bmi < 18.5):
                print("BMI value:", bmi, "\tUnderweight")
        # if bmi greater than or eqoal to 18.5 and less than or equal to 24.9, then Normal weight
        elif(bmi >= 18.5 and bmi <= 24.9):
                print("BMI value:", bmi, "\tNormal Weight")
        # if bmi greater than or eqoal to 25 and less than or equal to 29.9, then Over weight
        elif(bmi >= 25 and bmi <= 29.9):
                print("BMI value:", bmi, "\tQverweight")
        # if bmi greater than or equal to 30, then Obese
        elif(bmi >= 30):
                print("BMI value:", bmi, "\tObese")
# else condition for age
else:
        # if no
        # prints that age should be 18 or greater
        print("Age should be greater than or equal to 18")

CODE SCREENSHOT

OUTPUT

Age restriction


Related Solutions

Post a Python program that accepts at least three values as input, performs some computation and...
Post a Python program that accepts at least three values as input, performs some computation and displays at least two values as the result. The program must include an if statement that performs different computations based on the value of one of the inputs. Include comments in your program that describe what the program does. Also post a screen shot of executing your program on at least two test cases.
Post a Python program that accepts at least three values as input, performs some computation and...
Post a Python program that accepts at least three values as input, performs some computation and displays at least two values as the result. The program must include an if statement that performs different computations based on the value of one of the inputs. Include comments in your program that describe what the program does. Also post a screen shot of executing your program on at least two test cases. I would like to build a code along with these...
Post a Python program that contains an array variable whose values are input by the user....
Post a Python program that contains an array variable whose values are input by the user. It should the perform some modification to each element of array using a loop and then the modified array should be displayed. Include comments in your program that describe what the program does. Also post a screen shot of executing your program on at least one test case.
PYTHON Write a program that accepts a range of input from the user and checks whether...
PYTHON Write a program that accepts a range of input from the user and checks whether the input data is sorted or not. If the data series is already sorted your program should print “True” or should print “False” otherwise. You should not use any sort function for this program. Input: How many numbers you want to input: 3 # user input 3 Input the number: 5 Input the number: 2 Input the number: 7 Output: False
Design a Python script that accepts as input a user-provided list and transforms it into a...
Design a Python script that accepts as input a user-provided list and transforms it into a different list in preparation for data analysis, the transformed list replaces each numeric element in the original list with its base-10 order of magnitude and replaces string elements with blanks. Example: This script accepts as input a user-provided list expected to contain non-zero numbers and strings. It then prints a transformed list replacing numbers with their order of magnitude, and strings as blanks. Type...
PYTHON Write a python program that encrypts and decrypts the user input. Note – Your input...
PYTHON Write a python program that encrypts and decrypts the user input. Note – Your input should be only lowercase characters with no spaces. Your program should have a secret distance given by the user that will be used for encryption/decryption. Each character of the user’s input should be offset by the distance value given by the user For Encryption Process: Take the string and reverse the string. Encrypt the reverse string with each character replaced with distance value (x)...
Write a program that accepts a string and character as input, then counts and displays the...
Write a program that accepts a string and character as input, then counts and displays the number of times that character appears (in upper- or lowercase) in the string. Use C++ Enter a string: mallet Enter a character: a "A" appears 1 time(s) Enter a string: Racecar Enter a character: R "R" appears 2 time(s)
Write a complete MiniMIPS program that accepts a seqeunce of integers at input and after the...
Write a complete MiniMIPS program that accepts a seqeunce of integers at input and after the receipt of each new input value, displays the largest and smallest integers thus far. An input of 0 indicates the end of input values and is not an input value itself. Note that you do not need to keep all integers in memory.
In python, write a function, called ThreeSum, that accepts a list of non-negative numbers as input,...
In python, write a function, called ThreeSum, that accepts a list of non-negative numbers as input, and returns the highest sum of three neighboring elements in it. Write a main method that initializes the following five lists, gets the ThreeSum result for all of them using the above function, and prints the result to the screen. Example of the output: List 1: [4,5,4,5] , Three sum = 14 List 2: [7] , Three sum = 7 List 3: [ ]...
Python Using tkinter, create a GUI interface which accepts input of a GPA. If the GPA...
Python Using tkinter, create a GUI interface which accepts input of a GPA. If the GPA is >= 3.5, display 'Dean’s List' If the GPA is < 2.0, display 'Probation’ If the GPA is < 3.5 and >= 2.0, display 'Regular Standing' Run one test case for each case above and save the output.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT