Python Forum
I am new to python and Could someone please explain how this below code is working?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I am new to python and Could someone please explain how this below code is working?
#1
a=True
try:
    assert a and not print("sucess"),"failure"
except Exception as e:
    print("e is",e)
Output is Sucess when a is True
and Output is Failure when a is False

Could someone please explain how this code is working in detail?
snippsat write Dec-19-2022, 04:25 PM:
Added code tag in your post,look at BBCode on how to use.
Reply


Messages In This Thread
I am new to python and Could someone please explain how this below code is working? - by kartheekdas - Dec-19-2022, 03:36 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  New to Python - Not sure why this code isn't working - Any help appreciated TheGreatNinx 4 999 Jul-22-2023, 10:21 PM
Last Post: Pedroski55
  code not working when executed from flask app ThomasDC 1 935 Jul-18-2023, 07:16 AM
Last Post: ThomasDC
  New to python/coding Need help on Understanding why this code isn't working. Thanks! mat3372 8 1,805 May-09-2023, 08:47 AM
Last Post: buran
  [split] Explain the python code in this definition Led_Zeppelin 1 770 Jan-13-2023, 10:20 PM
Last Post: deanhystad
  Explain the python code in this definition Led_Zeppelin 1 1,129 Oct-27-2022, 04:04 AM
Last Post: deanhystad
Exclamation My code is not working as I expected and I don't know why! Marinho 4 1,109 Oct-13-2022, 08:09 PM
Last Post: deanhystad
  Sudoku Solver in Python - Can someone explain this code ? qwemx 6 2,183 Jun-27-2022, 12:46 PM
Last Post: deanhystad
  Can someone explain this small snippet of code like I am a 5 year old? PythonNPC 3 1,283 Apr-08-2022, 05:54 PM
Last Post: deanhystad
  My Code isn't working... End3r 4 1,970 Mar-21-2022, 10:12 AM
Last Post: End3r
  Could you explain each part of the code? Tsushida 2 1,547 Mar-20-2022, 08:19 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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