-
Notifications
You must be signed in to change notification settings - Fork 0
Python
lilshibata edited this page Oct 9, 2020
·
3 revisions
Pycharm Community Edition 2020.2
Tutorials: learnpython.org
Lists:
- Like arrays
- Can contain any type of variable & can contain as many variables as you want
mylist = []
mylist.append(1)
mylist.append(2)
mylist.append(3)
print(mylist[0])
- If you want to refer to something in the list then:
list_"name"[0, 1, 2....]
Arithmetic Operators
- Modulo (%) operator
remainder = 11% 3
print(remainder)
prints 2
- Double multiplication signs // power (ex. **2 is ^2 and **3 is ^3)
- Can print concatenating string
helloworld = "hello" + " " + "world"
print(helloworld)
prints hello world
lotsofhellos = "hello" * 10
print(lotsofhellos)
// prints hello 10 times in a row, no spaces no new lines