Python Forum
Operations on indexed variables in loop
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Operations on indexed variables in loop
#1
Hello,
Beginner in Python and having spent about 4 hours in this very simple operation, I now rely on your expertise. I'm used to Javascript and in JS you can when you have sets of variables defined (say they're array or matrices), create a loop on those variables indexes to create new ones.
The input variables are defined such as v1, v2, v3, ..., v10 and I want to create new variables such as v11, v12, ..., v20; using the numbers in the name of the variables in the loop index
in my language it'd be:
for i in range (0,10):
	v[i+10]=v[i]/2
Must precise that I'm using Python code into an embedded software so it knows what are the v1, v2, etc...
Any idea what's wrong in here?
Many thanks!
Reply


Messages In This Thread
Operations on indexed variables in loop - by Fibulavie - Aug-14-2019, 05:36 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Creating a loop with dynamic variables instead of hardcoded values FugaziRocks 3 1,430 Jul-27-2022, 08:50 PM
Last Post: rob101
  Replicate Excel operations with Python Lumberjack 3 1,773 May-10-2022, 01:44 AM
Last Post: Lumberjack
  WHILE Loop - constant variables NOT working with user input boundaries C0D3R 4 1,434 Apr-05-2022, 06:18 AM
Last Post: C0D3R
  how to use 3 variables python loop evilcode1 2 1,632 Nov-12-2021, 11:43 AM
Last Post: jamesaarr
  Program demonstrates operations of bitwise operators without using bitwise operations ShawnYang 2 1,757 Aug-18-2021, 03:06 PM
Last Post: deanhystad
  Creating a variables inside FOR loop zazas321 5 4,040 Sep-16-2020, 04:42 PM
Last Post: Naheed
  Random Choice Operations Souls99 6 2,889 Jul-31-2020, 10:37 PM
Last Post: Souls99
  Two variables in loop Ferdis 1 1,520 Jul-24-2020, 10:18 AM
Last Post: buran
  Create bot to automate operations in IQ Option JonatasCavalini 0 12,271 Jul-19-2020, 02:23 AM
Last Post: JonatasCavalini
  Two operations in two ranges salwa17 3 2,094 Jun-22-2020, 04:15 PM
Last Post: perfringo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020