Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: str in str == True
Post: str in str == True

Why do my 3rd and 4th lines give different results? 3 prints True, 4 prints False. Thanks! blue = "lm" my_size = "l" print(my_size in blue) print(my_size in blue == True)
speedskis777 General Coding Help 7 3,299 Mar-26-2019, 08:15 AM
    Thread: if var is "string"
Post: if var is "string"

In this code, what's the difference between my first three conditionals and the 4th one (elif size is "a":)? They all look like the same type of if statement to me! S = 0 M = 0 L = 0 while True: ...
speedskis777 General Coding Help 1 1,883 Mar-24-2019, 01:53 PM
    Thread: simple syntax question
Post: RE: simple syntax question

(Mar-10-2019, 11:58 PM)Yoriz Wrote: You are missing that the first argument is true. Any string value other than "" is evaluated to True. Okay I get it now, thanks! Clear example of what's going on...
speedskis777 General Coding Help 7 3,601 Mar-11-2019, 12:11 AM
    Thread: simple syntax question
Post: RE: simple syntax question

(Mar-10-2019, 05:34 PM)Yoriz Wrote: Multiple expressions with "or" keyword Thanks Yoriz. I'll stick to the methods advised in that link. So I will use: print(var == "/" or var == "*")I'm still reall...
speedskis777 General Coding Help 7 3,601 Mar-10-2019, 11:45 PM
    Thread: simple syntax question
Post: RE: simple syntax question

Thanks, Archie. I'm not sure I completely follow, though. Docs says: x or y if x is false, then y, else x (1) This is a short-circuit operator, so it only evaluates the second argument if the first ...
speedskis777 General Coding Help 7 3,601 Mar-10-2019, 04:59 PM
    Thread: simple syntax question
Post: simple syntax question

Hi. Why does the order matter here? What would be the correct syntax to print two True statements? var = "*" print(var == ("/" or "*")) print(var == ("*" or "/"))Thanks
speedskis777 General Coding Help 7 3,601 Mar-10-2019, 02:48 PM

User Panel Messages

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