#8 : List Comprehensions | Hackerrank Python Solutions

preview_player
Показать описание
Thanks if u r Watching us....
#Python #Dev19 #HackerankSOlutions #C #C++ #Java #Python
Please Subscribe Us ....
Рекомендации по теме
Комментарии
Автор

print([[i, j, k] for i in range(x+1) for j in range(y+1) for k in range(z+1) if i+j+k != n])

equites
Автор

list=[[a, b, c] for a in range(x+1) for b in range(y+1) for c in range(z+1) if a+b+c != n]

print(list)

ltambito
Автор

Bro, they have clearly mentioned to not solve using this method. You haven't spoken about List Comprehensions at all. Just add a rick roll somewhere to this video.

byshreyas
Автор

although this is not list comprehensions way to solve problem but you made concept clear thanks!

premspal
Автор

does anyone understand this list comprehension ? >>>> return 1 in [c in word for c in charlist] . I am not getting it.

zakjay
Автор

1) using if loop only:(1 condition only)
[ expression ---> loop ---> condition ]
(for) (if)

akashshinde
Автор

Dude they have told to not use this method. The point of this whole problem was to learn about list comphrehensions 🤦‍♀

shibourne
Автор

Without using function how can you use return bro

shyamkidiwani
Автор

we had to use list comprehension instead of loop

abhijain
Автор

good work buddy i know you did not use list comprehensions although I learn from your videos keep going

parthdalsaniya
Автор

They mentioned in the question to try not to use for loop !!

saimanojvarmakalidindi
Автор

full_liste = [[a, b, c] for a in range(x+1) for b in range(y+1) for c in range(z+1)]
new_full_liste = []
for liste_name in full_liste :
if reduce(lambda a, b: a + b, liste_name ) != n :

print(new_full_liste)
#do not forget to import reduce from functools

cyrilverwimp
Автор

hello, buddy you didn't use list comprehensions man!😂👌👌 nice and simple

pitoonshindi
Автор

how we can use this problem in real life situations

ashokthegamer
Автор

Hi everyone please try this one, this solution is using list comprehension and this will work for you 100%:

l = [[i, j, k] for i in range(x+1) for j in range(y+1) for k in range(z+1) if (i+j+k) != n]
print(l)

aaliyanmalik
Автор

x=int(input('enter the value of x'))
y=int(input('enter the value of y'))
z=int(input('enter the value of z'))

n=int(input('enter the value of n'))


list=[[a, b, c] for a in range(x+1) for b in range(y+1) for c in range(z+1) ]
list1=[[a, b, c] if a+b+c==n else [] for a in range(x+1) for b in range(y+1) for c in range(z+1)]
i=0
while i<len(list1):
if list1[i] in list:
list.remove(list1[i])
else:
pass
i+=1
print(list)
list comprehension compleated

feagy
Автор

Bhai at least second solution to mil Gaya, Ty

a-rushikeshlokhande
Автор

Are list compression lagana tha lala, pr tere logic sahi tha

aadil
Автор

list comprehension likha hai for loop use kar raha hai

nikhilsahijwani
Автор

for god sake improve your English or talk in Hindi

sowadhossain