Skip to content
Sign upLog in
← Back to Community

How to do IF statements?

Profile icon
madmonster

I learnt python from a book which is outdated. It was a book published in 2013 and its IF statements that don't work.

Voters
Profile icon
21CheesebroughO
Profile icon
JusticeMartin
Profile icon
VanillaPIe
Profile icon
willbog896
Profile icon
AmySpinney
Profile icon
OmarElmihi
Profile icon
MyieshaAnnAnn
Profile icon
asamukeku
Profile icon
OluwafunbiModup
Profile icon
TatumBanks
Comments
hotnewtop
Profile icon
abc3354

I don't think that the if statements changes between python version however :

#Simple if/else if condition: print("do something") else: print("do something else") # You must use always the same indentation #Or print("do something in one line") if condition

You may find a beginner course if you course is outdated, you can find online courses.
Maybe someone else knows a good course ?


Replit helper here !
If you found my answer helpful, you can upvote :)

Profile icon
UNDeF1ND

if (boolean):
and then the if statement will indent. backspace to stop it.

Profile icon
AllAwesome497

Here is pythons tutorial: https://docs.python.org/3/tutorial/

if _______: _____ #Indention is how it tracks what’s in the if statement
Profile icon
madmonster

@AllAwesome497
Thank you!!!!!

Profile icon
AllAwesome497

@madmonster
any time

Profile icon
EDJ102

Python is always updating, so that is why your if\else commands are not working.

Profile icon
TatumBanks

I keep forgetting a lot of things to Replit such as variables if statements etc.

Profile icon
18staleyn

I would also suggest trying code academy. You may have to slug through stuff you already know how to do, but it may give you refreshers or teach you a few things you didnt realize you could do or things you forgot how to do, as well as teaching you new things.