please help to solve the following problem on python 3.0 please
Translate the following problem descriptions into Python.
b) Are the parentheses in the expression required? Why or why not?
table into Python code:
pH value |
Message to be printed |
Less than 7.0, but not lower than the minimum of 0.0 |
“Acidic” |
Exactly 7.0 |
“Neutral” |
More than 7.0, but not higher than the maximum of 14.0 |
“Basic” |
Below the minimum or above the maximum |
“Invalid pH” |
pH test value |
Reason for testing that value |
Expected result |
Actual result when run |
Do not fill this in |
|||
Do not fill this in |
Please find the answers to each question below and let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please rate the answer. If not, PLEASE let me know before you rate, I’ll help you fix whatever issues. Thanks # If score is greater than or equal to 90, then grade is set to ‘A’. if score >= 90: grade = 'A' # If the expression t / (p – v) is greater than 10, then r is set to 0. # If the result is not greater than 10, r is set to three times its initial value if t / (p - v) > 10: r = 0 else: r = 3 * r # b) Are the parentheses in the expression required? # answer: Yes, otherwise expression becomes t / p-v and t/p is performed first and v is subtracted # from the result, which is wrong. # If the expression number % 3 results in an answer of 0, print a message saying that number is evenly divisible by 3. # If number % 5 results in an answer of 0, print a message saying that number is evenly divisible by 5. if number % 3 == 0: print(number, 'is evenly divisible by 3') if number % 5 == 0: print(number, 'is evenly divisible by 5') # note: you may change second if statement to elif if you want to execute the second if only if first is not satisfied # if pH is below 0 or above 14, displaying Invalid pH if pH < 0.0 or pH > 14.0: print("Invalid pH") # otherwise (pH is valid), checking if it is below 7.0 elif pH < 7.0: print("Acidic") # 0-6.99 # otherwise checking if pH is exactly 7 elif pH == 7.0: print("Neutral") # otherwise (now only one case is remaining, pH will be definitely between 7.0 and 14.0) else: print("Basic") # few good test values for testing above pH classification would be -2, 3, 6.9, 7, 7.2, 12 and 15 because it # covers all the cases. if you are limited to only two, use 7 and 10
please help to solve the following problem on python 3.0 please Translate the following problem descriptions...
1. Evaluate the following expressions if p = 8, 9 = 3, and the value of the variable found is False. Show your work. . q <= p . not (p == 4-5) . q != p % 5 . found or p > 5 and q == p + 5 2. Are you able to draw the truth tables for AND, OR, and NOT logical expressions? - Translate the following problem descriptions into Python. 3. If score is greater...
USE PYTHON 3, RUN THE CODE BEFORE POSTING THE ANSWER, AND READ THE ASSIGNMENT REQUIREMENTS NOTE CAREFULLY: Assignment Requirements NOTE: This program requires the use of if, elif, else, and casting between strings and numbers. The program should use the various code syntax covered in module 3. The program must result in print output using numeric input similar to that shown in the sample output below. Program: Cheese Order set values for maximum and minimum order variables set value for...
PYTHON I need help with this Python problem, please follow all the rules! Please help! THANK YOU! Bonus Question Implement an efficient algorithm (Python code) for finding the 11th largest element in a list of size n. Assume that n will be greater than 11. det find 11th largest numberlissy Given, lissy, a list of n integers, the above function will return the 11th largest integer from lissy You can assume that length of lissy will be greater than 11....
Q1 SUMMER2020- nts python language Example Write a program to read an integer r then print a triangle with r number of rows using .asterisks Result Input 5 Hint: Use end= parameter of the print function to not add a newline to the end of the string * * * * * * * * * * * * 9 - عام python language Course Information o Course Material Assignments o example input Lab Exercises Quizzes Result 7.0 ACUTE 7.0...
Swapping Values in python Summary In this lab, you complete a Python program that swaps values stored in three variables and determines maximum and minimum values. The Python file provided for this lab contains the necessary input and output statements. You want to end up with the smallest value stored in the variable named first and the largest value stored in the variable named third. You need to write the statements that compare the values and swap them if appropriate....
need help with python program The objectives of this lab assignment are as follows: . Input data from user Perform several different calculations Implement conditional logic in loop • Implement logic in functions Output information to user Skills Required To properly complete this assignment, you will need to apply the following skills: . Read string input from the console and convert input to required numeric data-types Understand how to use the Python Modulo Operator Understand the if / elif /...
HELP PYTHON 3.0 (NOT JAVA) 1.HTTP is the protocol that governs communications between web servers and web clients (i.e. browsers). Part of the protocol includes a status code returned by the server to tell the browser the status of its most recent page request. Some of the codes and their meanings are listed below: 200, OK (fulfilled) 403, forbidden 404, not found 500, server error Given an int variable status, write a statement that prints out, on a line by...
use python please #The Joyner Conjecture is a not-at-all famous mathematical #series inspired by the Collatz Conjecture for use in this #class. # #The Joyner Conjecture proceeds as follows: # #Start with any number. If the number is divisible by 3, #divide it by 3. Otherwise, add 2 to the number. Eventually, #no matter what number you begin with, this series will run #into 1 or 2. If it runs into 1, it will repeat 1-3 forever. #If it runs...
1) Translate the following equation into a Python assignment statement 2) Write Python code that prints PLUS, MINUS, O ZERO, depending on the value stored in a variable named N. 3) What is printed by: 3 - 1 while 5: while 10 Print ) Page 1 of 9 4) Write a Python while loop that reads in integers until the user enters a negative number, then prints the sum of the numbers. 1-2 of 9 4) Write a Python while...
use python IDEL Please highlight the answer Problem 1 Errors and Exceptions. There are two main types of errors: syntax errors and runtime errors. Syntax errors are detected by the Python interpreter before the program execution during the parsing stage (parsing is a process, during which the Python interpreter analyzes the grammatical structure of the program). Runtime errors are errors in a program that are not detected by the Python interpreter during its parsing stage. They are further divided into...