Ask coding questions

← Back to all posts
Idk how to do anything
LeviBernard (3)

me trying but failing

Comments
hotnewtop
RYANTADIPARTHI (5693)

Solution

try putting int() to the num instead, since you can't get numbers with strings.

for num in numbers:
  if int(num) >= 0:
    print(num, end = " ")

total = 0

like that.
That should work

zplusfour (879)

Python has data types functions, like str, and str converts a number to a string (or anything else except a string) and int is the opposite! it converts a string (or anything else except a number) to a number!

#Python_Is_EZ_But_It_Is_Boring

InvisibleOne (2060)

#Python_Is_EZ_And_it_is_NOT_Boring @ZDev1

InvisibleOne (2060)

That depends on what you do with it @ZDev1

zplusfour (879)

@InvisibleOne um
last time i used python was before 4 months, to create a flask web server to my cousin, because he wants to share it with his class lmao

GEISTCODER (20)

I'm sure you can do something. You just need further practice and some help with a side of a little self-confidence. I'm sure you can code amazingly (better than me anyway) :D

GEISTCODER (20)

Try learning CSS or somethin.

JBloves27 (1504)

Hello @LeviBernard,
It would be correct if you put this in the ask section. Also the error is probably you have to do this:

for num in numbers:
  if int(num) >=0:
    print(num, end=" ")

I hope this helps!

[deleted]

try putting int(num) instead