Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Begin and End in Python blocks

I am using Python

but the space gap is making my life very hard with it

example

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

when I use the if statement

if Parm2 == 1:
    Ch = "A"
elif Parm2 == 2:
    Ch = "B"
elif Parm2 == 3:
    Ch = "C"
else:
    continue
mdl = CallFunc(Parm2)

print("XX Always Print XX")

now the "XX Always Print XX" should be printed regardless

but due to my mistake it is inside the if statement which cause me long time to find

the actual if statement is nested and longer

I wonder if there is a method I can use begin/end or {} in such statements in Python

something like

UPDATE

for the people who focus on the IF statement

if Parm2 == 1:
{
    Ch = "A"
}
elif Parm2 == 2:
{
    Ch = "B"
}
elif Parm2 == 3:
{
    Ch = "C"
}
else:
{
    mdl = CallFunc(Parm2)
}
print("XX Always Print XX")

Happy now??

ok now how to get the brackets work in Python?

>Solution :

Python is indentation based. Yeah, its harder to read and make mistakes like you indicated, but that’s what it is.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading