Opposites
The last important keyword is not.
if not (ram < 8):
print("Enough memory")
Copy code
Copy And Save
Share
Ask Copilot
Save
This is equivalent to writing:
if ram >= 8:
print("Enouph memory")
Copy code
Copy And Save
Share
Ask Copilot
Save
Notice that it's >= now. Why? (What happens if the variable ram is exactly 8?)
All of this is the field of logic!
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter