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 to export property values with django-import-export
Plotting Coordinate Lines Using Matplotlib
BASH - Summarising information present in 2 genotype data columns in one column (ped file) [closed]
Python 3: How to call function from another file and pass arguments to that function ?
Streaming mp3 files in Django through Nginx
Opening PE file with Bokken
Python exercise: last letter / first letter
Python/Pygame: Can you run a program whilst having a Pygame window that can still update?
Replacing values in array from netCDF
confused about Python list syntax
Object orientated function parameter to alter variables
Batch processing and breaking up an image
How can I connect multiple if statements when using regular expressions?
Using A For Loop to Return Unique Values in a Pandas Dataframe
Scraping a paginated website with fixed url for every page (Python)
How to index a Cartesian product

Categories

HOME
vue.js
numpy
itext
smartphone
otrs
formal-verification
visualization
amazon-product-api
bibtex
hyperledger-fabric
bro
schemacrawler
eval
structuremap
dropbear
outlook-web-addins
lagom
qt-installer
scenebuilder
anychart
vs2017
flexboxgrid
sensu
ghost-inspector
source-maps
go-cd
fabric
activepython
geopandas
web-frontend
cgal
forum
vegan
picturebox
skygear
spring-insight
m2e
geo
modelandview
division
lego
parent
polyfills
web-development-server
knockout-3.0
productivity
distributed-transactions
lftp
resuming-training
scalafx
dojox.grid.datagrid
chunked-encoding
volume
etherpad
react-native-fbsdk
addin-express
galleriffic
try-finally
freetype2
metalsmith
date-format
logcat
sun-codemodel
yoothemes
web-essentials
anythingslider
selendroid
playscape
castle-windsor-3
divide-by-zero
gray-code
swift2.1
xaml-designer
httpie
musl
jai
chaining
obfuscar
tilestache
ultrawingrid
microblaze
ghostdoc
alpha-transparency
io.js
bsp
boost-test
wss
bounds
bigint
nservicebus4
nuspec
soa-suite
process-monitor
rose-db-object
gjs
point-sprites
mysql-error-1045
goliath
rubycas
noir
squeel
libavformat
mvccontrib-grid
carbide
task-management
visual-c++-2008-express
kpi

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