"How can I write a program to calculate the prime numbers below a certain max value?" Now, in terms of the solution to your overall problem and question I recommend that you include a default return statement at the end of your code, not only within the condition itself. Which will inherently check whether or not the function returns True without you needing to specify it.Īdditionally, you are not returning anything in your code if the condition does not trigger. ![]() Instead, if you wanted to call the function and check the return value from it, you would have to use parenthesis like so: if(is_factor(a, b) = True): In other words, you are doing a comparison between the object itself rather than invoking the function. ![]() ![]() The reason that your code is returning blank when you run it, is because you are comparing a function type to the value of True, rather than calling it.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |