Issue
When i try short hend if_else stetment with assingment operater syntaxerror is happening.i want to result based on the condition.like if condition is true so print 1 otherwise 0.
a=100
b=20
c=1 if(a>b) else c=0
print(c)
expecting 1 or 0 based on the condition.
Solution
try
a=100
b=20
c=1 if(a>b) else 0
print(c)
you do not have to redeclare that c = 0 after the else, if i am correct.
Answered By - yukii
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.