Go With the Flow
- Control flow gives us this ability to choose among outcomes based on what else is happening in the program.
- Comparators
-Equal to (
==
)
-Not equal to (
!=
)
-Less than (
<
)
-Less than or equal to (
<=
)
-Greater than (
>
)
-Greater than or equal to (
>=
)
-To the power of (**)
Ex:
- Boolean operators compare statements and result in boolean values. There are three boolean operators:
-
and
, which checks if both the statements are True
;
-
or
, which checks if at least one of the statements is True
;
-
not
, which gives the opposite of the statement.
Note: As it moves on, the lesson gets trickier. I start to mess up a little bit with all the "not true" "not not false"
- Pay attention to the indentation before the
print
statement. This space, called white space, is how Python knows we are entering a new block of code. Python accepts many different kinds of indentation to indicate blocks. In this lesson, we use four spaces but elsewhere you might encounter two-space indentation or tabs (which Python will see as different from spaces). - The
else
statement complements theif
statement. elif
is short for "else if."
What I learned...
I learned the control flow of the Language, but it's kind of hard because it is really easy to have things mixed up as the logic are really similar. And it's just making it hard by saying it in different ways, such as:"False" "Not true" "Not not false".
What I'll be doing tomorrow...
I will be moving onto another lesson in the Python Language called
No comments:
Post a Comment