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

 

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

First solve the problem at https://codingbat.com/prob/p202587 and then come to the current problem. Define a function that when passed an integer, returns true if it can be split in a way that the left and right parts are both prime, false otherwise. For example, you can split 7313 right down the middle and the left part - 73, and the right part 13, are both primes. BTW, you can also split it after the 7 so that both 7 and 313 are prime. Similarly, 893 split after the 9 results in primes on either side - 89 and 3. However, 277 cannot be split in a way that the left and right parts are prime.


prime_combination(277) → False
prime_combination(893) → True
prime_combination(7313) → True

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

def prime_combination(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: 4 Post-solution available

Copyright Nick Parlante 2017 - privacy