n1=int(input('enter first number:'))
n2=int(input('enter second number:'))
n3=int(input('enter third number:'))
if n1>=n2 and n1>=n3:
maxi=n1
elif n2>=n1 and n2>=n3:
maxi=n2
else:
maxi=n3
print('maximum value is',maxi)
(OR)
# using ternary operator
maxi=n1 if n1>=n2 else n2
maxi= maxi if maxi>=n3 else n3
print('maximum value is',maxi)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter