Today we will look at a sample program or python script to get maximum number out of a set of numbers say 3.
Lets have a look at the program.
# Lets define a function max_num with 3 arguments. # The function will return maximum number out of these three numbers. def max_num(n1,n2,n3): if n1>=n2 and n1>=n3: return n1 elif n2>=n1 and n2>=n3: return n2 else: return n3 print(max_num(23,43,56))
Lets run the program and see its output.
/Users/saket/PycharmProjects/1helloworld/venv/bin/python /Users/saketPycharmProjects/1helloworld/if_else_script.py 56