Python Cheatsheet Extracted
Python Cheatsheet Extracted
background 2.PNG
Text
cA)
Visuals
Image editing
Quick actions
Crop to object
*é
Adjustments
Auto enhance
True
>>> Car = Sautit
>>> Car == thew”
False
ore - 15
if-else statements
ome - 27
Sf age < 4:
orice - @
elif ope < 28:
price - 5
else:
price = 18
True
False
Af playe
for player in players:
print(*Player: * » player.title(})
else:
print("ne nave no players yet!”)
209% -~
Simple input
Sf age >= 1
print("\aYou can vete!")
else:
Caunting to §
current_nuaber = 1
while current_nunber <= 5:
print(current_ausber)
current_nurber += 1
message - ~
while message !- ‘quit’:
message - input (prorpt)
if message !+ ‘quit’;
print (nessoge)
Using a flag
active + True
while active:
message = input(prenpt)
if message == ‘quit’:
active » False
else:
print (nessage)
wnile True:
city = input(orospt)
if city == ‘quit’:
break
else:
while True:
name = input("\rWo are you? “)
orint(“Nice to meet vou. ~ + name + “!*)
Making a dictionary
print( ners)
print(pets)
Making 2 function
lef yreet_user():
**isplay a sieple preeting.*"*
prant(“Kello!")
greet_user()
Passing a single argument
det yreet_user(usernane) =
“““Dasplay 2 simple greeting.
prant("Hello, " + usernare +
greet_user(' jesse")
greet_user("diana")
Rreet_user('beeedon’ )
def greet_users(names):
“““Brint a simple greeting ta everyone.
for name in names:
asp - “Hello,
print(rsg)
usernames = ["hannah ", “margot’)
greet_users(usernanes
orint_models(unprintes, grintec)
ungrintec)
printed)
orint("\nunprintec
print( “Printed:
print_madels(criginal[:], printed)
print("\nOriginal:", original)
print("Printed:", printed)
return profile
OQ Save &
Using a colormap
A colormap varies the point colors from one shade to another,
based on a certain value for each point. The value used to
determine the color of each point is passed to the c argument, and
the cmap argument specifies which colormap to use.
Pygal allows you to fill the area under or over each series of data.
The default is to fill from the x-axis up, but you can fill from any
horizontal line using the zero argument.
t = pygal.Line(fill=True, zero=0@)
ENG Ady O
5:36 PM
6/8/2025