My issue
im trying to solve this with a faster method
My code
# cook your dish here
x=list(map(int,input().split()))
tally=0
for i in x:
if i>10:
tally=tally+1
print(tally)
Problem Link: PRACTICEPERF Problem - CodeChef
im trying to solve this with a faster method
# cook your dish here
x=list(map(int,input().split()))
tally=0
for i in x:
if i>10:
tally=tally+1
print(tally)
Problem Link: PRACTICEPERF Problem - CodeChef
for i in range(x):
You’re missing “range”.
Also, you need to take the length of x and subtract 1 from it.
Hence,
for i in range(len(x)-1):
Then there is a problem in your if statement, you are checking if the ith element is greater than equal to 10 or not.
if(x[i] >10):
Solution:-
x=list(map(int,input().split()))
a = 0
for i in range(0,len(x)):
if x[i]>=10:
a+=1
print(a)