Python Forum
Weird behaviour using if statement in python 3.10.8
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Weird behaviour using if statement in python 3.10.8
#5
1 does not equal 2 so will always be false
The brackets are not required in the if statement,
print(1 == 2)
if 1 == 2:
    print("[...]")
print("Ended")
Output:
False Ended

(Jan-15-2023, 05:03 PM)mikepy Wrote: To be honest I don't know why there is no possibility like in other forums to copy and paste images.
(Jan-15-2023, 05:16 PM)deanhystad Wrote: You can paste images.
But the forum rules advise people to not post images, so please don't.

https://python-forum.io/misc.php?action=help&hid=21 Wrote:What to NOT include in a post
Images of text. Please do not take a screenshot of your traceback or code, just copy and paste the text of it in the post using BBCode. If this text is within a popup that you cannot copy the text out of, please use this tool to acquire the text from within it (for windows users). We need to copy and paste your code and cannot do so with an image.
ndc85430 likes this post
Reply


Messages In This Thread
RE: Wired behavior using if statement in python 3.10.8 - by Yoriz - Jan-15-2023, 05:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  logger behaviour setdetnet 1 953 Apr-15-2023, 05:20 AM
Last Post: Gribouillis
  can someone explain this __del__ behaviour? rjdegraff42 1 796 Apr-12-2023, 03:25 PM
Last Post: deanhystad
  Asyncio weird behaviour vugz 2 1,371 Apr-09-2023, 01:48 AM
Last Post: vugz
  Generator behaviour bla123bla 2 1,170 Jul-26-2022, 07:30 PM
Last Post: bla123bla
  Inconsistent behaviour in output - web scraping Steve 6 2,701 Sep-20-2021, 01:54 AM
Last Post: Larz60+
  IWhat is the cause to get XPath in weird format using Python? MDRI 7 3,849 May-27-2021, 02:01 AM
Last Post: MDRI
  Adding to the dictionary inside the for-loop - weird behaviour InputOutput007 5 2,853 Jan-21-2021, 02:21 PM
Last Post: InputOutput007
  Behaviour of 2D array SimonB 6 2,964 Jan-21-2021, 01:29 PM
Last Post: SimonB
  strange behaviour- plotting nathan_Blanc_Haifa 0 1,538 Dec-27-2020, 01:37 PM
Last Post: nathan_Blanc_Haifa
  OOP behaviour problem JohnB 3 2,485 Aug-18-2020, 07:51 PM
Last Post: JohnB

Forum Jump:

User Panel Messages

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