How to say if this number is equal or less than X the change it to X

I am trying to make code that can round numbers i am starting off small and don't know why but getting errors and am trying to state "if this number is less or equal to 4 change the value to zero and print it, otherwise if it is greater than or eqaul to 5 the change it to a 10"

import math
import random

def help(num):
   
if num <= 4 num = "0"

else:
    
if num >= 5 num = "10"

result = help(5)

print(result)

If you aren't already, try using an IDE (I use PyCharm). These will highlight errors in your code and give suggestions as to how you may fix or handle them.

First of all, python requires proper formatting of whitespace to run correctly. Here's a useful StackOverflow link to give you an idea of what I mean.

Secondly, when you want to refer to a real number value, (i.e The mathematical number 0 as opposed to the letter representing 0), don't use quotes. When you use quotes you tell python "this is a word made of letters" instead of a number made of digits.

Third, you are missing the colon : at the end of your if and else statements. These are just necessary syntax.

Fourth, you need a return statement in your help() function if you want it to return a value.

Lastly, ensure that the last two lines are not within the method help() if you want them to run when the .py file is run.

Here's your modified code:

import math
import random


def help(num):
    if num <= 4 :
        num = 0
    elif num >= 5:
        num = "10"
    return num

result = help(5)
print(result)

You don't need to be checking for greater or equal to 5 in this case if you've got just two outcomes.

def help(num):
    return 0 if num <=4 else 10

result = help(5)
print(result)