+ 1

Input Trouble

When I write len(input()) and then I put a matrix on it, it counts all the characters and not only the length of the matrix. What am I doing wrong? Thanks for your attention.

8th Feb 2018, 2:26 PM
Bruna Dias
Bruna Dias - avatar
5 Respuestas
+ 3
Posting code will help you get a better answer😊
8th Feb 2018, 2:38 PM
Ole113
Ole113 - avatar
+ 1
how is the matrix formatted? code sample?
8th Feb 2018, 2:57 PM
Markus Kaleton
Markus Kaleton - avatar
+ 1
The input should be something like [[5,7,8],[0,2,6],[0,0,8]]. And I wanted len(input()) == len([[5,7,8],[0,2,6],[0,0,8]]). It works when I write the matrix, but I wanted to add an input, so that people could try with any matrix in that form.
8th Feb 2018, 3:02 PM
Bruna Dias
Bruna Dias - avatar
+ 1
store userinput as list instead of a string
8th Feb 2018, 3:07 PM
Markus Kaleton
Markus Kaleton - avatar
0
Well, since it was reading [[], []] as "[[], []]" I made a function to create a matrix based on the string. Now it really works. Thank you all. I will made my code public, so if you want to see it just check my profile. It calculates the matrix determinant based on an input of the form above. Enjoy it! ☺️
8th Feb 2018, 4:07 PM
Bruna Dias
Bruna Dias - avatar