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
  in c# create a loop counting from 0 to 5, consecutively Frankd 19 2,728 Apr-01-2025, 12:46 PM
Last Post: Frankd
  Create X Number of Variables and Assign Data RockBlok 8 4,321 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 8,906 Nov-07-2023, 09:49 AM
Last Post: buran
Question How create programmatically variables ? SpongeB0B 6 3,963 Aug-19-2023, 05:10 AM
Last Post: SpongeB0B
  How to print variables in function? samuelbachorik 3 1,906 Dec-31-2022, 11:12 PM
Last Post: stevendaprano
  Creating a loop with dynamic variables instead of hardcoded values FugaziRocks 3 2,614 Jul-27-2022, 08:50 PM
Last Post: rob101
  Create array of values from 2 variables paulo79 1 2,006 Apr-19-2022, 08:28 PM
Last Post: deanhystad
  WHILE Loop - constant variables NOT working with user input boundaries C0D3R 4 2,644 Apr-05-2022, 06:18 AM
Last Post: C0D3R
  How to create 2 dimensional variables in Python? plumberpy 5 3,374 Mar-31-2022, 03:15 AM
Last Post: plumberpy
  how to use 3 variables python loop evilcode1 2 2,521 Nov-12-2021, 11:43 AM
Last Post: jamesaarr

Forum Jump:

User Panel Messages

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