First Negative

Lab Python Beginner 10 points

Read a line of integers and print the first negative one. If there is none, print none. Use break and a for-else.

Input

One line of integers.

Output

A number or none.

Example

Input

4 7 -2 9 -5

Output

-2
Sample input available Sample output available
Editor
Python

Hints

The else of a for loop runs only if the loop finished without break.

Solution explanation

for … else avoids a separate "found" flag variable.

Show solution
for x in map(int, input().split()):
    if x < 0:
        print(x)
        break
else:
    print("none")
Output
Answer
HOME LEARN COMMUNITY DASHBOARD