Write a multi-way if statement that compares the double variable pH with 7.0 and makes the following assignments to the bool variables neutral, base, and acid:

Answers

Answer 1

Answer:

try:

   pH = float(input("Enter number between 0 to 14: "))

except ValueError:

   print("input must be a number")

if pH < 7:

   print("pH is Acidity")

elif pH == 7:

   print("pH is neutral")

else:

   print("pH is Base/alkaline")(

Explanation:

The try and except statement is used to check if the input is a number, if its not, the print statement is displayed. The nested if statement compares the pH input to know if it is an acid, base or neutral.


Related Questions

Lab9A: Warmup. Write a program that contains three methods: Method max (int x, int y, int z) returns the maximum value of three integer values. Method min (int X, int y, int z) returns the minimum value of three integer values. Method average (int x, int y, int z) returns the average of three integer values. Note: for Java and C#, these methods must be public and static. Prompt the user for three numbers, then call these methods from main to print out the minimum, maximum and average of numbers that the user entered. Your program should behave like the sample output below. Sample output #1 Enter number 1: 5 Enter number 2: 9 Enter number 3: 2 Min is 2 Max is 9 Average is 5.33333 Sample output 2 Enter number : 45 Enter number 2 : 11 Enter number 3: -3 Min is-3 Max is 45 Average is 17.6667

Answers

import java.util.Scanner;

import java.util.Arrays;

public class JavaApplication30 {

   public static int max(int x, int y, int z){

       int[] arr = {x, y, z};

       Arrays.sort(arr);

       return arr[2];

   }

   public static int min(int x, int y, int z){

       int[] arr = {x, y, z};

       Arrays.sort(arr);

       return arr[0];

   }

   public static double average(int x, int y, int z){

       return  (double) (x + y + z) / 3;

   }

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Enter your first number");

       int x = scan.nextInt();

       System.out.println("Enter your second number");

       int y = scan.nextInt();

       System.out.println("Enter your third number");

       int z = scan.nextInt();

       

       System.out.println("Min is "+min(x,y,z));

       System.out.println("Max is "+max(x,y,z));

       System.out.println("Average is "+average(x,y,z));

   }

   

}

I hope this helps! If you have any more questions, I'll try my best to answer them.

Allison is writing a program in Java and keeps getting an error. Which line of code is causing the error?

A. Int a = 0, b = 3, c;
B. for(i = 0, i <= 13, i++) {
C. c = (a * 2) + i;
D. System.out.println(c);

}

Answers

B will cause an error.

Allison needs to declare a type for variable i and use semi-colons.

The for statement should be for(int i = 0; i <=13; i++){

Vector testGrades contains NUM_VALS test scores. Write a for loop that sets sumExtra to the total extra credit received. Full credit is 100, so anything over 100 is extra credit.

Answers

Question:

Vector testGrades contains NUM_VALS test scores. Write a for loop that sets sumExtra to the total extra credit received. Full credit is 100, so anything over 100 is extra credit. Ex: If testGrades = {101, 83, 107, 90}, then sumExtra = 8, because 1 + 0 + 7 + 0 is 8.

#include <iostream>

#include <vector>

using namespace std;  

int main() {

  const int NUM_VALS = 4;

  vector<int> testGrades(NUM_VALS);

  int i = 0;

  int sumExtra = -9999; // Assign sumExtra with 0 before your for loop  

  testGrades.at(0) = 101;

  testGrades.at(1) = 83;

  testGrades.at(2) = 107;

  testGrades.at(3) = 90;

   /* Your solution goes here  */

  cout << "sumExtra: " << sumExtra << endl;

  return 0;

}

Answer:

Replace /* Your solution goes here  */  with the following lines of code

sumExtra = 0;

do{

if(testGrades.at(i) > 100){

sumExtra = sumExtra + (testGrades.at(i) - 100);

}

i++;

}

while(i<NUM_VALS);

Explanation:

In the complete question posted,  the variables sumExtra and i have already been declared an initialized.

So, the first thing we do in the solution is:

set  sumExtra to 0 using sumExtra = 0;

Then iterate through vector testGrades using i as the iterating variable

Here, I made used of a do while loop and the explanation is as follows:

do{

This line checks if current element of the vector is greater than 100

if(testGrades.at(i) > 100){

If yes, the extra digits above 100 is added to the sumExtra

sumExtra = sumExtra + (testGrades.at(i) - 100);

}

The counter is increased, here

i++;

}

The loop is continued while the iterating variable i is less than NUM_VALS which is 4

while(i<NUM_VALS);

Which best explains the workplaces of employees in the Energy career cluster?

Employees work outdoors.
Employees can work in a wide variety of places.
Employees can work in a limited number of places.
Employees work indoors.

Answers

Answer: It’s Letter (B) the other ones just don’t fit.

Explanation:

Mark me as brainlest please?!!

Answer:

b

Explanation:

Shrink-wrap, box-top, and click-wrap agreements are inherent to e-commerce. How you feel about them often depends on whether you are the vendor or purchaser. What are the best practices to assure shrink-wrap, box-top, and click-wrap agreements are legal? What are the best ethical practices that the e-commerce industry should adopt?

Answers

Answer:

Shrink-wrap, Box-top, and Click-wrap Agreements

a) The best practices to assure that shrink-wrap, box-top, and click-wrap agreements are legal include  

1) having e-commerce terms and conditions separate from the normal trade terms and conditions,  

2) ensuring that customers agree to the terms before entering into a transaction, and  

3) laying the code of conduct for all visitors interacting with your site or doing any business transaction on your site.

b) The best ethical practices that the e-commerce industry should adopt are:

1) Put additional layers of protection like a web application firewall to their websites.  

2) Ensure they always adhere to PCI (Payment Card Industry) compliance guidelines.

3) They should not store customers' data which they do not need.

4) Ensure privacy and security of customers' data.

5) Establish trust by safeguarding intellectual property rights.

6) Consider some environmental issues (customers care about them).

Explanation:

a) Websites' Terms and Conditions (T&C) establish some form of legal contract between the organization and its clients.  

b)To ensure that organizations that process, store, or transmit credit card information maintain secure online environment, they are required to comply with PCI DSS.  It is a set of Payment Card Industry requirements for all organizations involved in the use of online cards for payment for their goods and services.

Using complete sentences post a detailed response to the following.

What are the advantages and disadvantages of top-down and bottom-up programming? How would you decide which one to use? Do you approach problems in your real life from a bottom-up or top-down approach?

Answers

Answer:

some advantages of top down is that you can start off from what you know and figure out what you need to complete it, advantages to bottom up is that you can make something new . if you are starting something from scratch and you dont know what the end goal might be you would use bottom up but if you already have an idea or the final product of what you want you would go the top down approach.

Explanation: just saying you shouldnt just copy and paste my response but rather pick out what you want to say and use this to complete what ever your working on. hope i helped :)

Answer:

the guy on top of me is super right follow him

Explanation:

There is no danger of data collision with this topology.

bus
mesh
ring
star

Answers

Answer:

ring

Explanation:

The Answer


C.Ring

This is evident beacause I am your advisor and I made that test so

Who wants to play nitro type with me. My user is thievesGuildcuu

Answers

Answer:

I can

Explanation:

Answer:

Sure.

My user Name is: Queen Void.

A user can view
and
in the Reading pane.

Answers

Answer:

sorry,but I can't understand your question.

Answer:

email messaging and attachments

Explanation:

2023 edg 100%

What is payload?
a block of data inside the packet
a block of data transmitted across a network
the maximum amount of data a network can transmit
a 32-bit numeric address

Answers

Answer:

a block of data inside the packet

Other Questions
In four to five sentences, compare and contrast the governments of Sparta and Athens. 1.Evaluate the extent to which the emergence of regional identities shaped the political development of theUnited States from 1800-1848. The science center has 200 people in attendance on Monday. The center expects Saturdays attendance to be 140 percent of Mondays attendance. Natasha is trying to figure out how many people will be in attendance. Her work is shown below. StartFraction part Over whole EndFraction = StartFraction 140 Over 100 EndFraction StartFraction 140 divided by 2 Over 100 times 2 EndFraction = StartFraction question mark Over 200 EndFraction 140 divided by 2 = 70 70 people will be in attendance. What mistake did Natasha make? Natasha should have multiplied 140 by 2. Natasha should have divided 100 by 2. Natasha should have added 140 and 200. Natasha should have multiplied 140 and 200. Does the table represent a function? Then representthe relationship using words, an equation, and agraph.I need crucial help! 12. What does Prospero reveal about himself in this soliloquy? Match the term with the correct definitionQuestion 3 options:It is a government where the monarch and the constitutionally organized governing body share power. The monarch is the head of state, but the decisions are made by the government.one person makes all decisions for the government.It is a form of rule in which a single person has undivided rule of absolute sovereigntymany people run the government and have a say in decisions.It is the political doctrine and practice of unlimited centralized authority and absolutely sovereignty, vested in a monarch or dictator. The leader is not kept in check by any other governing body.1. Democracy2. Autocracy3. Absolutism4. Monarchy5. Constitutional Monarchy Explain the 4 regions of the Arabian Peninsula in your own words g(x)=x+2 graph the parent function Example of a balance point Popular sovereignty means that government shares power with the people. is by the people, for the people. is equal to the people. frees the people from government. Find an expression for the nth term (tn) in each of the following sequence:2, 6, 10, 14, 18 Which statement best summarizes the soldier'sthoughts?Living in the trenches was mostly dull, with little tooccupy the soldiers' time.Living in the trenches could be deadly, but alsovery exciting.O Living in the trenches was a lot like living backhome, with both ups and downs.O Living in the trenches was very dangerous, withfew of the comforts of home. I will give brainiest to who answer please fast Which graph describes the relation {(3, 1), (1, 2), (3, 2), (5, 5)}? Please help :( this is a really complicated question What is the answer to 34.50r+78.50(810-r) What tool of dream analysis says that feelings and urges are hidden inside an event? condensation symbolism projection displacement Urgent please help, I will truly be grateful Solve me a riddle, there is a wall in your path that you can't go through, around, or over. Question 4 of 15 Which was a result of apartheid? A. Nelson Mandela was jailed for 27 years. B. The black population became a minority. C. Hutus and Tutsis engaged in a brutal civil war. D. Blacks gained equal rights under the law.