From f8e18a62c701bda8d75b1e0d34d9447433a6c6fc Mon Sep 17 00:00:00 2001 From: waldek Date: Mon, 2 May 2022 16:32:53 +0200 Subject: [PATCH] fixes spelling mistakes --- learning_python3.md | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/learning_python3.md b/learning_python3.md index f63d11a..8424ddc 100644 --- a/learning_python3.md +++ b/learning_python3.md @@ -1400,9 +1400,10 @@ if __name__ == "__main__": -#Logical Operators +# Logical Operators -There is three types of logical operators. All operators returns boolean. +There is three types of logical operators. +All operators return boolean values, ie `True` or `False`. | Operator | Result | |-----------------|---------------------------------------------| @@ -1421,13 +1422,15 @@ DealerName = "Paul" DealerAgreement = True if CustomerAgreement and DealerAgreement : - print(f"Youpi !!! {CustomerName} and {DealerName} are agreed ") + print(f"Youpi !!! {CustomerName} and {DealerName} agree") else: - print(f"Oh no {CustomerName} and {DealerName} are disagreed ;( ") + print(f"Oh no, {CustomerName} and {DealerName} don't agree... ;(") ``` -As you can guess, Jean and Paul are agreeing to the deal. If I had put 'False' in DealerAgreement boolean, the result will be inverse. -Let's show an another example with the `Or` operator. +As you can guess, Jean and Paul are agreeing to the deal. +If I had put `False` in `DealerAgreement` boolean, the result would be reversed. + +Let's show another example but this time with the `Or` operator. ````python3 def Choice_cold_hot(Temperature): @@ -1436,13 +1439,18 @@ def Choice_cold_hot(Temperature): else: print("Let's go to the beach") + if __name__ == "__main__": Temperature = int(input("What is the temperature")) Choice_cold_hot(Temperature) ```` -Look at this code, if the temperature is smaller than 20° or bigger than 40°, you must stay home and don't go to the beach. So, if I put 35° for temperature, it will say that you should go to the beach. -Let's make an exercise. You have to take the previous code and use the `And` operator. +Look at this code, if the temperature is smaller than 20° or bigger than 40°, you must stay home and don't go to the beach. +So, if I put 35° as temperature, it will say that you should go to the beach. + +Let's try this out as an exercise! +Reuse the previous code but integrate the `And` operator. +The result should be identical.
Spoiler warning @@ -1453,13 +1461,15 @@ def Choice_cold_hot(Temperature): print("Let's go to the beach") else: print("Don't go outside") + + if __name__ == "__main__": Temperature = int(input("What is the temperature")) Choice_cold_hot(Temperature) ````
-Now, we have used that operators, we can use the last logical operator. The `Not` operator sends the reverse of the result. +Now that we have discovered the base operators we can learn the last logical operator `not` which gives us the reverse of the expected result. ````python3 if __name__ == "__main__": @@ -1469,7 +1479,9 @@ if __name__ == "__main__": else: print("That will be expensive") ```` + In this example, if you tap yes, the result will be reversed. + # Lists The different built-in objects we've seen until now, such as `str` and `int` are simple [text](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str) and [numeric](https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex) types.