by CodeChum Admin
We've been dealing with integers too much, it's time for decimals to shine!
Instructions:
Input
A line containing five decimal numbers separated by a space.
1.1·1.2·1.3·1.4·1.1
Output
The first line contains all the inputted decimal numbers separated by a space.
The second line contains a string which is the result.
1.1·1.2·1.3·1.4·1.1
Yes
def check(arr2):
if len(arr2)<5 or len(arr2)>5:
print("MUst be 5 decimal numbers")
return
print("Output")
if arr2[0]+arr2[1]+arr2[2]+arr2[3]>arr2[4]:
print(*arr2)
print('Yes')
else:
print(*arr2)
arr1= input("Enter 5 decimal numbers separated by space: ").split()
arr2=[]
for i in arr1:
arr2.append(round(float(i),1))
check(arr2)
Comments
Leave a comment