Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
If statement
#7
(Feb-01-2020, 07:00 PM)el_bueno Wrote: Thank you a looooot.

What confuses me more is that I used s,p and r as conditions, so aren't we supposed to get an error if we use anything different then s,p and r?
s='Hungry'
p='Im full'
r=7

Still, I want to understand why aren't we having an error when we use 8?

So lets get this straight one and for all!

So If is influenced by False and True.

Which leads us to have two cases:

First case
1- We can use False and True after if
if True: or
if False:
Second case
2-we can use values
a-integers:
0 means False
Different than 0 means True
b-If we use strings:
They should be predefined in order to use them, when defined they means true and if they aren't defined they means False and we get an error

Am I getting it right?
Reply


Messages In This Thread
If statement - by el_bueno - Feb-01-2020, 05:59 PM
RE: If statement - by ibreeden - Feb-01-2020, 06:05 PM
RE: If statement - by el_bueno - Feb-01-2020, 07:00 PM
RE: If statement - by el_bueno - Feb-01-2020, 08:25 PM
RE: If statement - by ndc85430 - Feb-01-2020, 07:09 PM
RE: If statement - by el_bueno - Feb-01-2020, 07:24 PM
RE: If statement - by ndc85430 - Feb-01-2020, 07:31 PM
RE: If statement - by ibreeden - Feb-02-2020, 10:04 AM
RE: If statement - by el_bueno - Feb-03-2020, 01:43 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020