Bringing It All Together: Nice Work! So Far, You've Learned About
Bringing It All Together: Nice Work! So Far, You've Learned About
Bringing It All Together: Nice Work! So Far, You've Learned About
Python:
Chapter 1:
For Example:
Spam = 5
Booleans: A Boolean is like a light switch. It can have only two values. Like light switch can only be
on or off. A Boolean can only be true or false.
a = true
b = false
Interpreter: The interpreter runs your code line by line, and checks for any errors.
Single Line Comments: The # sign is for comments. A comment is a line of text that Python won't try
to run as code. It's just for humans to read.
Modulo: Modulo returns the remainder from a division. So, if you type 3 % 2, it will return 1,
because 2 goes into 3 evenly once, with 1 left over.
Length of String:
lower
You can use the lower ( ) method to get rid of all the capitalization in your strings.
str()
Now let's look at str(), which is a little less straightforward. The str() method turns
non-strings into strings!
Dot Notation
Let's take a closer look at why you use len(string) and str(object), but dot notation
(such as "String".upper()) for the rest.