python


Changing the len() function in Python [closed]


Before, in my code I had this vector:
x = [
[0.72,0.82],
[0.91,-0.69],
[0.03,0.93],
[0.12,0.25],
[0.96,0.47],
[0.8,-0.75]
]
And there was this for that worked correctly:
for k in range(1,10):
for i in range(0,len(x)):
sum = 0
for j in range(0,len(x[i])):
sum += x[i][j] * w[j]
I have to make a change in the vector:
x = [
[0.72,0.82,-1],
[0.91,-0.69,-1],
[0.03,0.93,-1],
[0.12,0.25,-1],
[0.96,0.47,-1],
[0.8,-0.75,-1]
]
In this sense, I realize that I need to make a modification in my len(x[i]) so that the previous result is the same as now, I tried to len(x[0][1]), but it did not work, what could I do?

just have j go from 0 to 1 then. (or if you want, "len(x[i]) - 1")
for k in range(1,10):
for i in range(0,len(x)):
sum = 0
for j in range(2):
sum += x[i][j] * w[j]


Related Links

Output loop result into a list
Pyinstaller will create an executable with --onefile, but not without it
PyMongo update multiple records with multiple data
How to automatically input ssh private key passphrase with pexpect
Extract only the portion of a string between two regex patterns
Filtering dictionary keys by a function of their associated values
webrtc without a browser
Simple python IF statement not working?
Python: aliased to python3
replacing certain expressions in file but only one time
why recompile python after lib devels installed?
Unable to scrape google news accurately
How to optimize factorization code in Python?
How do I represent this FOR loop in Python?
Assigning the reference of one object to a variable does not work in a python script but works in command line
Reading UTF8 Encoded File in PyCharm

Categories

HOME
vb6
raspbian
uibutton
json-ld
cocos2d-x-3.0
safari
rfc
propertygrid
deeplearning4j
xamarin-studio
nixos
abcpdf
informatica-powercenter
ctypes
viber
jacoco
lenskit
session-timeout
off-canvas-menu
ms-access-2007
movies
jogl
cython
deb
binutils
k2
remove-method
rworldmap
searchbar
iis-10
data-cleansing
geopandas
ggmap
fileinfo
clockwork
smart-mobile-studio
superpowered
openpgp
bigcartel
concrete5-5.7
restful-url
socketscan
ical-dotnet
mediawiki-extensions
react-native-router-flux
lumen-5.3
floor
pinvoke
emoticons
redux-router
qos
lotus
picasa
audioqueue
codesign
console-redirect
gradle-release-plugin
proxygen
persistence.xml
eyeql
vips
code-readability
registrykey
sevenzipsharp
pyrocms
prezto
pisa
omnifocus
outline
emma
colt
opensocial
ksoap2
hamsterdb
wic
logentries
nimrod
shiva3d
symphony-cms
n-layer
icefaces-3
supersized
selectonemenu
charts4j
port-scanning
libavformat
hadoop-plugins
revert
yajl
boost-date-time
asp.net-mvc-controller
swfloader
system-codedom-compiler
configurable





Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm