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

In SQLAlchemy is it possible to dump and load from a Table (not from a mapped class)?
Python: Parsing logical string into list of lists
Optical flow with OpenCV and Python using initial flow estimate
What is the difference between numpy.polyfit and scipy.polyfit? [duplicate]
How to get the value of submitted option of django_filters in view?
Cannot upload text files to django project
How to create a unit test to check the response of an API made in Flask?
cannot access excel file using Pandas Python
Python OpenCV: Conversion from float to int for using cv2.line()
Make a Scatter Plot in matplotlib with dates on x axis and values on y
Decoding NumPy int64 binary representation
Groupby DataFram by its rank/percentile
AttributeError: 'str' object has no attribute 'loads', json.loads()
Can anyone explain me the example of an exploit in Python’s pickle module?
Why does pandas multi-index dataframe slicing seem inconsistent?
How to restore a tensorflow network and to use it

Categories

HOME
cntk
windows-7
fparsec
avro
chaiscript
is-empty
apache2
user
oclint
cockroachdb
uiview
maxima
rebol2
multiple-monitors
pyephem
flat-file
chocolatey
zoho
thumbnails
multiple-columns
jni
jconsole
sensu
google-ima
url.action
kitematic
servicemix
richfaces
profile
spring-test
vcard
partial-application
aurelia-binding
pygooglechart
read-write
median
lftp
automator
vcf
aqgridview
floor
appstore-approval
decompress
crash-reports
castle-dynamicproxy
objloader
cfeclipse
hspec
gameanalytics
bacnet
asteriskami
fps
faraday
freefem++
django-south
anti-cheat
fill
handlebars.java
license-key
asymptote
document-oriented-db
p-np
apigee-baas
programming-paradigms
pyopengl
ejabberd-saas
kallithea
belongs-to
pgagent
sysctl
kendo-mvvm
adcolony
em
code-testing
neoload
ifft
crystal-reports-10
lov
visual-c++-2010-express
dynamic-proxy
bsod
opendata
sql-server-2012-web
html-form-post
dwolla
xslkey
client-library
awesomeprint
gdt
nemerle
adsl
nagle
.app
drawtext
msn
recordset
boost-date-time
visual-c++-2008-express
grooveshark
rtsp-client
economics





Mobile Apps Dev
Database Users
javascript
java
csharp
php
android


MS Developer
developer works
python
ios
c
html
jquery


RDBMS discuss