Where did go wrong? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 9

Where did go wrong?

Desperate help please https://code.sololearn.com/cMs0Ksh3SCe4/?ref=app

9th May 2020, 12:58 PM
Calvin Capstone
Calvin Capstone - avatar
60 Answers
+ 8
Pls stop posting duplicate answers... Is there seriously any logical difference if you change the variable name used in range?
10th May 2020, 9:49 AM
Bartika๐ŸŽถ
Bartika๐ŸŽถ - avatar
+ 7
Guyz how do i use python with other cides
9th May 2020, 11:29 PM
BILL AMOS A
BILL AMOS A - avatar
+ 6
if all(x[i] * x[i] == y[i] for i in range(len(x))): print("true") else: print("false")
9th May 2020, 1:33 PM
Russ
Russ - avatar
+ 6
Calvin Capstone A number which is not divisible by any other number other than 1 and itself.
10th May 2020, 12:49 PM
Bartika๐ŸŽถ
Bartika๐ŸŽถ - avatar
+ 5
https://code.sololearn.com/cOU8s2z80Ji1/?ref=app Works Also you have posted two similar questions. Kindly delete one.
9th May 2020, 1:08 PM
Bartika๐ŸŽถ
Bartika๐ŸŽถ - avatar
+ 5
Or else it won't know which number to check with whom. It's a list. You have to mention the number's position.
9th May 2020, 1:14 PM
Bartika๐ŸŽถ
Bartika๐ŸŽถ - avatar
+ 4
https://code.sololearn.com/cBj1Qg0jYaqW/?ref=app If you just wanna show true or false then this would be enough
9th May 2020, 1:17 PM
Bartika๐ŸŽถ
Bartika๐ŸŽถ - avatar
+ 3
Change your code to something like this: x = (1,2,3,4,5,6,7,8,9,10,11,12,13) y = (1,4,9,16,25,36,49,64,81,100,121,144,169) if x[1]*x[1] == y: print("true") else: print("false") And you will get an output
9th May 2020, 11:29 PM
Anesu Mavhura
Anesu Mavhura - avatar
+ 3
Thx
9th May 2020, 11:42 PM
BILL AMOS A
BILL AMOS A - avatar
9th May 2020, 2:44 PM
Bartika๐ŸŽถ
Bartika๐ŸŽถ - avatar
+ 2
I rewrote your code. Try it this way: x = (1,2,3,4,5,6,7,8,9,10,11,12,13) y = (1,4,9,16,25,36,49,64,81,100,121,144,169) #if x*x == y: # print("true") #else: # print("false") for i in range(len(x)): mylist=[] if x[i] * x[i] == y[i]: print("True") else: print("false")
10th May 2020, 8:20 AM
Karzan
+ 2
Btw Bartika you mean perfectly divisible
10th May 2020, 12:56 PM
ACID
ACID - avatar
10th May 2020, 7:01 PM
Yash Mittal
Yash Mittal - avatar
+ 2
You created tuples "x" and "y", and tuples like strings can be multiplied by integers. This leads to a repetition of the original tuple. Tuples cannot be multiplied by other tuples. Tuples cannot also be multiplied by floating point numbers, even if they are integers. Example: x=1,2,3 print(x*2) #1,2,3,1,2,3
11th May 2020, 2:50 PM
Solo
Solo - avatar
+ 1
No number in "y" will ever be prime because all its elements are square numbers.
9th May 2020, 1:34 PM
Russ
Russ - avatar
+ 1
Do this question as below: x = (1,2,3,4,5,6,7,8,9,10,11,12,13) y = (1,4,9,16,25,36,49,64,81,100,121,144,169) for i in range(len(x)): if x[i]*x[i] == y[i]: print("true") else: print("false")
10th May 2020, 9:41 AM
Ronik Marghade
Ronik Marghade - avatar
+ 1
2,3,5,7,11,13. etc want more
10th May 2020, 12:52 PM
ACID
ACID - avatar
+ 1
Bartika ,Calvin Capstone ,Rithea Sreng Every number is divisble by any number .there will always be a result 3รท5 =0.6 You see ๐Ÿ˜ƒ๐Ÿ˜ƒ
10th May 2020, 12:59 PM
ACID
ACID - avatar
+ 1
No need to fight ๐Ÿ˜ฌ๐Ÿ˜ฌ
10th May 2020, 1:04 PM
ACID
ACID - avatar
+ 1
Sorry
10th May 2020, 1:04 PM
ACID
ACID - avatar