• + 2 comments

    I did in these way but still all my test cases other than 1 getting output wrong answer ,can anyone help me with the solution and what to update in the code ?

    !/bin/python3

    import math import os import random import re import sys if name == 'main': firstLast = input().split()

    first = int(firstLast[0])
    
    last =  int(firstLast[1])
    
    def prime(num):
        if num > 1:
            for j in range(2,num):
                if (num%j)==0:
                    return False
                    break
            return True
        else:
            return False
    
    
    
    f=lambda num:prime(int(num))
    count = 0
    for num in range(last,first+1): 
        if prime(num):
            if all(list(map(f,list(str(num))))):
                count+=1
    print(count)