First Negative Number
Given N inputs, write a program to print the first negative number.
N = 10
neg_number = None
for i in range(N):
x = float(input())
if x < 0 and neg_number is None:
neg_number = x
if neg_number is not None:
print(f'The first negative number is {neg_number}')
else:
print('There was not negative numbers')
Comments
Leave a comment