Python Forum
Create, assign and print variables in loop
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create, assign and print variables in loop
#11
Use a collection as mentioned. You can always create a string to identify each item just for the output of course (like var1, var2, ... or whatever is meaningful).

You've also mentioned you're new to the language, so why do you want so much to do something that people are telling you is a bad idea?

Of course, collections have quite useful operations that you can perform on them: counting the number of items, checking whether an item exists, adding/removing items, etc. You're likely to need some of those things, so do you really want to have to reinvent the wheel?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Create X Number of Variables and Assign Data RockBlok 8 925 Nov-14-2023, 08:46 AM
Last Post: perfringo
  How to create a variable only for use inside the scope of a while loop? Radical 10 1,683 Nov-07-2023, 09:49 AM
Last Post: buran
Question How create programmatically variables ? SpongeB0B 6 1,305 Aug-19-2023, 05:10 AM
Last Post: SpongeB0B
  How to print variables in function? samuelbachorik 3 902 Dec-31-2022, 11:12 PM
Last Post: stevendaprano
  Creating a loop with dynamic variables instead of hardcoded values FugaziRocks 3 1,480 Jul-27-2022, 08:50 PM
Last Post: rob101
  Create array of values from 2 variables paulo79 1 1,082 Apr-19-2022, 08:28 PM
Last Post: deanhystad
  WHILE Loop - constant variables NOT working with user input boundaries C0D3R 4 1,475 Apr-05-2022, 06:18 AM
Last Post: C0D3R
  How to create 2 dimensional variables in Python? plumberpy 5 1,848 Mar-31-2022, 03:15 AM
Last Post: plumberpy
  how to use 3 variables python loop evilcode1 2 1,665 Nov-12-2021, 11:43 AM
Last Post: jamesaarr
  How can I assign "multiple variables" to a single "value"? Psycpus 2 1,852 Oct-04-2021, 03:29 AM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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