Feb-19-2021, 12:40 AM
Hello All,
I understand this is probably a very basic question but I would appreciate any help.
I am working on the logic for some code and created the script below to figure out the syntax. The code show below works fine using different values for the variables and I think it is self explanatory.
I am trying to insert a condition in the "if g > h" block to also check if "g == h" and generate an output using a print statement. I have tried different structures but I cannot seem to get it to work.
Could someone please provide the correct syntax to add a condition in the "if g > h" block to also check if "g == h" and generate an output using a print statement?
Thank you in advance.
Oliver
I understand this is probably a very basic question but I would appreciate any help.
I am working on the logic for some code and created the script below to figure out the syntax. The code show below works fine using different values for the variables and I think it is self explanatory.
I am trying to insert a condition in the "if g > h" block to also check if "g == h" and generate an output using a print statement. I have tried different structures but I cannot seem to get it to work.
Could someone please provide the correct syntax to add a condition in the "if g > h" block to also check if "g == h" and generate an output using a print statement?
Thank you in advance.
Oliver
a = 4 b = 5 c = 6 d = 5 e = 6 f = 5 g = 6 h = 5 if a > b: print ('a is greater than b') elif a == b: if c > d: if e > f: print ('Yes') else: print('No') if g > h: print ('True') # <<<--------- Need to insert a condition here [when g==h / print('Neutral')] else: print('False') else: print ('a not greater than b')