Lesson 8 Flashcards
Don’t surround numbers with quotes
Integers
positive or negative whole numbers. use the int()function.
Floats
Numbers that have a decimal point. They are used the same way integers are used. To convert an integer or string to float use float()function.
Two different types of numbers in python
Ints and floats
%
modulus. It is the remaining portion of a quotient. 5/2 = 2 and remainder of 1. 1 is the modulus.
Exponent
**
Floor division
//. Divides two numbers and ignores the remainder. 5/2 = 2. 1 is gone.
Lists
A variable that stores multiple values. Can store numbers, strings, and other lists.
Lists format
they use square brackets.
The ending index for a list
Its not include [1:4] only 2,3,4 will print out of (1,2,3,4,5)
Append()function
adds a new item to the end of a list
remove()function
removes an item from a list. You remove using the name of the value not the index number.
sort()function
Put the list into numerical or alphabetical order
reverse()function
Puts the list in the reverse order
len()function
get the number of items in a list and print it.