+ 1

Arrays(python)

how do you transfer a users' input into an array? also how do you go through an array, performing an operation on each one with the other. for instance my array is (2, 3) I want to multiply 2 by 2 and 2 by 3. also multiplying 3 by 2 and 3 by 3.

3rd Jan 2018, 1:12 PM
Smart
5 Antworten
+ 4
arr=[] arr.append(int(input())) arr.append(int(input())) for x in arr: for y in arr: print(x*y)
3rd Jan 2018, 7:23 PM
Louis
Louis - avatar
+ 1
def variable(x,y): print x*x,x*y,y*x,y*y print int(input("print value of x")) print int(input("print value of y")) print (x,'*',x,x,'*'y,y,'*',x,y,'*',y,variable(x,y))
3rd Jan 2018, 4:56 PM
Sasin Nisar 83
Sasin Nisar 83 - avatar
0
thank you😋
4th Jan 2018, 6:24 AM
Smart
0
also
4th Jan 2018, 6:41 AM
Smart
0
what if you had no idea how many numbers and what number what will you do
4th Jan 2018, 7:28 AM
Smart