Code By Shraddha
Wednesday, May 25, 2022
Python If...else Statement
1) simple if statement
x = 23
if x > 0:
print("x is positive value")
print("this is always printed")
x = -1
if x > 0:
print(x, "is positive number")
print("this is also always printed")
output:
2)
if ...else statement
a = -7
if a > 0:
print(a, " is positive")
else:
print(a," is Negative")
output:
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment