0

How to use conditions (if ,if-else) in Python?

I'm having trouble handing conditionals in Python, like making a grade point average mas checking ir the student is approved or disapproved, I would like some tips.

12th Jun 2020, 4:04 PM
PELU
PELU - avatar
4 odpowiedzi
+ 8
If statements have pretty straightforward construction: if [something is True]: <do this> elif [something else is True]: <do that> else [in all other cases]: <do otherwise> If you share your code we might be more specific about it. Meanwhile, refresh the relevant lesson here: https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2277/
12th Jun 2020, 4:16 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 4
The issue in your code in the moment is that you try to use an undefined identifyer: print(Approved) use instead: print("Approved")
12th Jun 2020, 8:44 PM
Lothar
Lothar - avatar
+ 1
The logics of code - if, else, loops - is something you have to (first understand, sure, but then) constantly practice until it starts to feel natural. Depending on where you start, that may take a while. The logic muscle has to develop over time - by training.
12th Jun 2020, 7:20 PM
HonFu
HonFu - avatar
+ 1
Thanks for the help, I will pratice more with the tips, and understand the code better.
12th Jun 2020, 9:26 PM
PELU
PELU - avatar