I am having a tricky question with me!!!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I am having a tricky question with me!!!!

write a program that get up to sum =8 of the given array [1,2,3,9 ].

9th Jun 2019, 8:28 AM
Naveen
Naveen - avatar
1 Answer
+ 6
Try this: a=[1,2,3,9,4] for k in a: for y in a: if k-y==8: print(str(k)+" - "+str(y)+" = 8") if k+y==8: print(str(k)+" + "+str(y)+" = 8") if k*y==8: print(str(k)+" * "+str(y)+" = 8") if k/y==8: print(str(k)+" / "+str(y)+" = 8") Python. It is not finished , but I hope you can finish it
9th Jun 2019, 10:50 AM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar