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

 

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

First, solve this problem: https://codingbat.com/prob/p204297 and then come to the current problem. Define a function that when passed an integer, returns the number of prime factors of the number. Note that if a number is a prime, it has only one prime factor: the number itself.


count_prime_factors(73) → 1
count_prime_factors(77) → 2
count_prime_factors(27161) → 2

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

def count_prime_factors(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: 6 Post-solution available

Copyright Nick Parlante 2017 - privacy