Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views

Python

The document contains three separate code snippets. The first snippet processes input to count certain conditions based on given parameters. The second snippet defines a method to filter words that can be typed using letters from the same keyboard row, and the third snippet calculates a sum based on a sequence and conditions related to multiples of five.

Uploaded by

aditibera276
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Python

The document contains three separate code snippets. The first snippet processes input to count certain conditions based on given parameters. The second snippet defines a method to filter words that can be typed using letters from the same keyboard row, and the third snippet calculates a sum based on a sequence and conditions related to multiples of five.

Uploaded by

aditibera276
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

t=int(input())

for i in range(t):
n,h,y1,y2,l= list(map(int,input().split(" ")))
b=0
for j in range(n):
ty,x=list(map(int,input().split(" ")))
if (ty== 1 and (h -y1) > x):
l-=1
elif (ty == 2 and (y2 < x)):
l-=1
if (l > 0):
b+=1
print(b)

class Solution(object):
def findWords(self, words):
row1=set("qwertyuiop")
row2=set("asdfghjkl")
row3=set("zxcvbnm")
result=[]
for word in words:
lowercase = set(word.lower())
if lowercase.issubset(row1) or lowercase.issubset(row2) or
lowercase.issubset(row3):
result.append(word)
return result
words = ["Hello", "Alaska", "Dad", "Peace"]
print(Solution().findWords(words))

n = int(input("enter the number"))


fsum=tsum=0
term=1
for i in range(1,n+1):
if(i%5==0):
fsum+=tsum
print(f"for i ={i}adding tsum={tsum}...")
tsum=0
else:
fsum+=tsum
tsum+=term
print(f"for i={i} now adding term = {term}")
term+=1
print(fsum)

You might also like