What is the problem with my code?

Chris Angelico rosuav at gmail.com
Mon Apr 27 02:48:51 EDT 2020


On Mon, Apr 27, 2020 at 4:26 PM <yoavmelnik5 at gmail.com> wrote:
>
> def is_positive_int(int):
>     x = int[0]
>     if int == "":
>         return Flase
>     elif int != "":
>         print(True)
>     if int[0] < 1:
>         return false
>     else:
>         print(True)
>     for x in int:
>     if x > 0 and x < 10:
>         print(True)
>         x = x + 1
>     else:
>         return False
>     if "." in int:
>         return False
>     else:
>         print(True)
>     return "int is True"
> print(is_positive_int("1 2 3 4 5 6 7 8 9"))

Lots of things. Have you tried running the code to see what Python
says about it? Never ask a human something you could more easily learn
from a computer.

ChrisA


More information about the Python-list mailing list