Skip to content

Commit

Permalink
.py program that finds the greatest of 5 numbers
Browse files Browse the repository at this point in the history
Only executes if input is 5 numbers no more, no less
  • Loading branch information
Abrish-Aadi authored Oct 12, 2022
1 parent a42a6fc commit 4fb827b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions greatest number.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
def greatest_number():
a=list(map(int,input("Input the 5 numbers with spaces - ").split(' ')))
if len(a)==5:
flag=a[0]
for i in a[1:]:
if i>=flag:
flag=i
else:
continue
print("The greatest number is",flag)
else:
print('You were supposed to enter 5 numbers.')


greatest_number()

0 comments on commit 4fb827b

Please sign in to comment.