# Help me in solving LUCKYFR problem

### My issue

What is the error in my code

### My code

``````# cook your dish here
for i in range(int(input())):
a=int(input())
count=0
for i in range(len(a)):
if(a[i]==4):
count+=1
print("count")
``````

Problem Link: LUCKYFR Problem - CodeChef

@bhavya1910
plzz refer the following solution for better understanding of the logic and implementation

``````#include <iostream>
#include <cmath>
#include <bits/stdc++.h>
using namespace std;

int main()
{
int t;
cin >> t;
while (t--)
{
int n, sum1 = 0;
cin >> n;
while (n != 0)
{
if (n % 10 == 4)
sum1++;
n = n / 10;
}
cout << sum1 << endl;
}
return 0;
}``````

Hi,
I think the mistake in code is you have given ‘a’ as input in integer and in for loop you have written len(a) .Integer doesnt has len() function resulting in Type Error. Convert integer to string and solve the problem

Here is Python Program which passes all cases.

``````# cook your dish here
t = int(input())
for _ in range(t):
l = int(input())
s = str(l)
count = 0
for i in s :
if i == '4':
count = count + 1
print(count)
``````