id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

gaurav1780@gmail.com 03_loops > is_prime
prev  |  next  |  chance

A number is called prime if it is more than 1, and is divisible only by 1 and itself. Define a function that when passed an integer, returns true if it is prime, false otherwise.


is_prime(77) → False
is_prime(73) → True
is_prime(103) → True

...Save, Compile, Run (ctrl-enter)

def is_prime(n):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 3 Post-solution available

Copyright Nick Parlante 2017 - privacy