You are on page 1of 2

111))))

a,b,c,d = 1933,16,4,3

if a <=255:
if b <=255:
if c <=255:
if d <=255:
print("valid")
else:
print("d is invalid")
else:
print(" c is invalid")
else:
print("b is invalid")
else:
print("a is invalid")

o/p:===
a is invalid:
===================================================================================
=================
2)))))

a,b,c,d = 1933,16,4,3

if a 0<=a <=255:
print("a is valid")
else:
print("a is invalid")
if 0<= b <=255:
print("b isvalid")
else:
print("b is invalid")
if 0<= c <=255:
print("c is valid")
else:
print("c is invalid")
if 0<= d <=255:
print("d is valid")
else:
print("d is invalid")

o/p===============
a is invalid
b isvalid
c is valid
d is valid

========================================================
33))))))))

a,b,c,d= 100,60,22,33
if a<b:
smallest = a
else:
smallest = b
if b <c:
smallest = b
else:
smallest = c
if c< d:
print(c)
else:
print(d)

o/p ==========
22

================================

a,b,c,d= 100,60,22,33

if a<=b and a<=c and a<=d:


print("a is the samllest number",a)
elif b<=a and b<=c and b<=d:
print("b is the samllest number",b)
elif c<=a and c<=b and c<=d:
print("c is the samllest number",c)
elif d<=a and d<=b and d<=c:
print("d is the samllest number",d)
else:
print("none of the above")
o/p======
22

===================================================================================
========================
4)))))))

a = int(input("enter the number"))


b = a%2 == 0

if b:
print("even number")
else:
print("odd number")

o/p====
4 even

a will give output 1 or 0 to b


In if condition 1 means True and 0 means False:
based on that it print.
===================================================================================
=========================

keyword:

pass === we can ignore the errors using pass keyword

You might also like