Python Cheat Sheet
If you ever need to remember how to do something quickly in Python, I hope this cheat sheet will do it 😀
croolic
1 min read
Feb 22, 2021
Creating a String Variable
# You can use single quotes
name = 'Nick'
# Or Double Quotes
name = "Nick"
Creating an Int or Float
age = 31
weight = 188.2
Comments
# Anything after a # in Python is a comment. In fact...YOU'RE READING ONE RIGHT NOW
Creating a Boolean
coding_is_fun = True
stop_the_music = False
If Statements
if age >= 18:
print('You\'re an adult!')
else:
print('You\'re a kid')
Loops
for number in range(10):
print(number)