170k views
5 votes
Write a program that reads a floating-point number from the user and prints "zero", "positive" or "negative"

1 Answer

5 votes
```
#!/usr/local/bin/python3

foo = float( input( "Enter a number: " ) )
if( foo < 0.0 ):
print( "negative" )
elif( foo > 0.0 ):
print( "positive" )
else
print( "zero" )

exit( 0 )
```

User Danique
by
8.3k points

No related questions found