Docsity

pH Levels programming, Guías, Proyectos, Investigaciones de Tecnología

Toggle sidebar
bg1
Institut Santa Eugènia
13. pH Levels
Programació 1r Batxillerat
13. pH LEVELS
1. RELATIONAL OPERATORS
❖A lot of the times inside conditions, we are comparing two values. To do so, we need to use a different type
of operators called relational operators that compares values:
➢== equal to
➢!= not equal to
➢> greater than
➢< less than
➢>= greater than or equal to
➢<= less than or equal to
2. ELIF
❖One or more elif statements (short for “else if”) can be optionally added in between the if and else to provide
additional condition(s) to check. Sometimes two is simply not enough.
TASK 13:
In chemistry, pH is a scale used to specify the acidity or basicity of a liquid.
1) Create a new folder with the name “13.pHLevels” and a new project inside with the same name.
2) Create a program that checks whether a pH level is basic, acidic, or neutral.
3) First, create a variable called ph and ask the user for a value between 0 and 14.
4) Write an if, elif, else statement that:
● If ph is greater than 7, output “Basic”.
● If ph is less than 7, output “Acidic”.
● Else, output “Neutral”.

Vista previa parcial del texto

¡Descarga pH Levels programming y más Guías, Proyectos, Investigaciones en PDF de Tecnología solo en Docsity!

Institut Santa Eugènia

  1. pH Levels Programació 1r Batxillerat

13. pH LEVELS

1. RELATIONAL OPERATORS

❖ A lot of the times inside conditions, we are comparing two values. To do so, we need to use a different type of operators called relational operators that compares values: ➢ == equal to ➢ != not equal to ➢ > greater than ➢ < less than ➢ >= greater than or equal to ➢ <= less than or equal to

2. ELIF

❖ One or more elif statements (short for “else if”) can be optionally added in between the if and else to provide additional condition(s) to check. Sometimes two is simply not enough. TASK 13: In chemistry, pH is a scale used to specify the acidity or basicity of a liquid.

  1. Create a new folder with the name “13.pHLevels” and a new project inside with the same name.
  2. Create a program that checks whether a pH level is basic, acidic, or neutral.
  3. First, create a variable called ph and ask the user for a value between 0 and 14.
  4. Write an if, elif, else statement that: ● If ph is greater than 7, output “Basic”. ● If ph is less than 7, output “Acidic”. ● Else, output “Neutral”.