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

Code against Pywin32 on OS X?
Pandas: Find previous row of matching value
PyGtk3, ToggleButton, “toggled-or-untoggled” event
Reaplce img value with value from list Python
Python - Displaying json data
Partial patch in Python with mock
Radio button does not get clicked in Selenium / Python
How to get base url only from textfile in python?
Processing Multiple files in hadoop python
GAE Python: Control access based on GSuite group
AWS Lambda DynamoDB Query Error
Python - Decision Trees and Handling Unique Labels/features
Matplotlib figure doesn't unpickle
UDP client-server. Client not sending string to the server
How can i calculate the percentage of strings that have a certain value in a field
How do changed the dtypes of multiple columns?

Categories

HOME
sharepoint
visual-studio-2015
nlp
checkbox
wsdl
uibutton
google-contacts
angular2-routing
json-ld
playframework
codeeffects
webdav
laravel-4
adsense
histogrammar
user
requirejs
httpclient
internet-explorer-11
aruco
xamarin-studio
cakephp-2.9
lagom
uiscrollview
flann
maxima
google-openid
koa
header-files
samsung-mobile
geopandas
codelite
data-conversion
autofill
xor
smart-mobile-studio
pyscripter
pljson
mapguide
large-data
parse-android-sdk
soundjs
mediawiki-extensions
rich-text-editor
double-buffering
chunked-encoding
web-deployment-project
azureportal
xmgrace
dwarf
tcserver
in-memory-database
collapsingtoolbarlayout
communication-protocol
vici
objloader
backstop.js
packagemaker
cron-task
git-annex
webkit2
zurb-foundation-apps
uiprogressview
metalsmith
altbeacon
multinomial
wikitext
selendroid
sem
webhdfs
type-mismatch
lines-of-code
isml
jazz
errorprovider
voldemort
chrome-for-android
visual-studio-addins
convex-polygon
ng-hide
execvp
stagefright
fluidsynth
icsharpcode
mvccontrib
enumerators
linkedhashset
javascriptserializer
symfony-2.0
deploying
legacy-code
tcxgrid
handwriting
newsstand-kit
adsl
delegatecommand
linfu
pci-bus
system-codedom-compiler
virtualquery
dotproject

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