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

how do I remove unwanted empty dimension from xarray DataArray (squeeze doesn't work)
How to do math expression from input() in Python?
opening luigi.LocalTarget in binary read mode (decoding error)
GPU slows way down after a few loops
Google's verify_id_token function not working
ImportError: libgomp.so.1: cannot open shared object file: No such file or directory
Django Iterating through an object set with unique_together and no pk
Can i deploy a Django project using Apache that is not located in /var/www?
How to run a python script on images present in firebase?
dictionary variable formatting in Python's Mysqldb
How to see print output from generator before ending the cycle?
Python script- need help understanding this while loop [closed]
Reset weights of a pretrained incetion_v3 model in Tensorflow
Trying to connect to FTP site but getting wrong SSL version number error?
Bokeh plot conditional background color
module installation - Mock

Categories

HOME
python
sharepoint
sql-server
caching
jar
uibutton
boost-thread
cocos2d-x-3.0
couchdb-2.0
phaser-framework
gimp
keystore
camera-calibration
informatica-powercenter
qt-installer
activesync
scala-native
sql-tuning
pyephem
tree-traversal
internet-explorer-8
zend-framework-mvc
boolean-expression
jquery-scrollify
logarithm
philips-hue
onesignal
continuous-deployment
fetch-api
helper
oracle-xml-db
hawtio
nunit-3.0
nlb
socketpair
infusionsoft
wcf-security
exiftool
code-composer
knockout-3.0
pdftk
jdbi
prototypejs
startapp
openweathermap
vcf
w3-total-cache
timesten
decompress
ruby-on-rails-2
photography
rxvt
garrys-mod
createobject
sqldatareader
libreadline
bacnet
scalar
shipitjs
asp.net-mvc-partialview
flexjson
difference
application-loader
zuora
unity5.3
matcaffe
retro-computing
apigee-baas
rx-groovy
lines-of-code
apache-mina
web-component-tester
orientation-changes
django-1.6
moai
rhel5
cocoascript
mov
csplit
eclipse-classpath
code-testing
sgml
indexing-service
config-files
magic-numbers
visualstatemanager
ksoap2
openkinect
facebook-sdk-3.1
.net-cf-3.5
onselect
swrl
shiva3d
database-permissions
abnf
fileutils
collect
smooth
server-error
yajl
communicationexception
usability-testing

Resources

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
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App