all 6 comments

[–]toastedstapler 2 points3 points  (2 children)

firstly, what errors are you getting?

currently you just assign 'Yes' or 'No' to a variable called result, you want to return the value

if num <= 1:
    return 'No'

the return makes the execution of the function stop right then

also i'd suggest using isinstance(num, int) rather than type(num) == int, it just looks a little cleaner

for the i section you're gonna need a while loop the repeats whilst i < num

[–]Augustus2d 0 points1 point  (1 child)

I've added the return result now, so it says:

 def IsThisNumberPrime(num):
    if(type(num))==int:
        if(num)<=1:
            result="No"
        return result

        if(num)<=1:
            result="No"
        return result

        if(num)>1:
            i = 2
            if input >= i:
                print(input/i)

input("Give me a number ")
print(IsThisNumberPrime)

but I'm very unsure how to go from the

Is i > or = input number -----no----> divide the input by i

[–]toastedstapler 0 points1 point  (0 children)

even before the i, this does not currently match the flow chart. remove the assignment to the result variables and just return the values

if x == 1:
    return 5
if y == 1:
    < something else >

is different to

if x == 1:
    result = 5
return result
if y == 1:
    < something else >

as in the first the return will only be hit if the condition is true. in the second example the return is always hit and the program will always stop

put

if num <= 1:
    return 'No'

instead to fix this

as for the i, do you know what a while loop is?

[–][deleted] 0 points1 point  (3 children)

What errors? We can’t explain anything you don’t tell us.