Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

lucky number codechef solution

# lucky no codechef problem in python


for _ in range(int(input())):
	a,b,c = list(map(int,input().split()))

	if 7 in (a,b,c):
		print('Yes')
	else:
		print("No")
Comment

Lucky four codechef solution

t=int(input())
a=str(4)
for i in range(t):
  x=str(input())
  count=0
  for j in x:
    if j==a:
      count=count+1
   print(count)
Comment

Lucky Four codechef solution in c++

------------------------------------------------------------------------------------------
//solution<1>:
------------------------------------------------------------------------------------------
#include<iostream>
#include<string>
using namespace std;

int main()
{
	int t, n, count;
	cin >> t;
	for (int i = 0; i < t; i++)
	{
		cin >> n;
		string s = to_string(n);
		count = 0;
		for (int i = 0; i < s.length(); i++)
		{
			if (s[i] == '4')
				count++;
		}
		cout << count << "
";
	}
	return 0;
}
------------------------------------------------------------------------------------------
//solution<2>:
------------------------------------------------------------------------------------------
#include<iostream>
using namespace std;

int main()
{
	int t, n, count, x;
	cin >> t;
	for (int i = 0; i < t; i++)
	{
		cin >> n;
		count = 0;
		while(n!=0)
		{
			x = n % 10;
			if (x == 4)
			{
				count++;
			}
			n /= 10;
		}
		cout << count << "
";
	}
	return 0;
}
Comment

PREVIOUS NEXT
Code Example
Python :: read variable in a string python 
Python :: pandas rearrange rows based on datetime index 
Python :: python argsort 
Python :: python ide 
Python :: Model In View Django 
Python :: python requests insecure request warning 
Python :: flask windows auto reload 
Python :: pytest create server 
Python :: windows python absolute path 
Python :: re.search variable 
Python :: Split a list based on a condition 
Python :: pandas replace word begins with contains 
Python :: numpy index of first true value 
Python :: input lstm 
Python :: package in python 
Python :: how to use re.sub 
Python :: how to declare a lambda function in python 
Python :: Python - How To Concatenate List of String 
Python :: reload class module python 
Python :: pass variable to thread target 
Python :: Python difference between filter and map 
Python :: A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N. 
Python :: how to remove text from plot in python 
Python :: python get module name 
Python :: print specific key in dictionary python 
Python :: python capitalize 
Python :: joining lists python 
Python :: django import could not be resolved 
Python :: explain the use of return keyword python 
Python :: python regeression line 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =