Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8676623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:14:37+00:00 2026-06-12T20:14:37+00:00

Basically, I need to make my program able to create multiple (unlimited) variables for

  • 0

Basically, I need to make my program able to create multiple (unlimited) variables for me, that I will still be able to use manipulate through my code, without me defining them.

I was thinking to have a letter and a number as the variable name, such as a1, and have the program create new variables just adding 1 to the number. So it would create a1 through a30 or so. How would I do this?

My program is going to add polynomials and the variables (or list now) is to separate the different monomials, and since I don’t know how many monomials there will be in the polynomial, I needed a way to make the number flexible so I have an exact amout of spaces for the monomials, no extras, and no less.

Here’s the code:

# Sample polynomial set to x, the real code will say x = (raw_input("Enter a Polynomial")).

x = '(5xx + 2y + 2xy)+ (4xx - 1xy)'

# Isdigit command set to 't' to make the code easier to write.
t = str.isdigit

# Defining v for later use.
v = 0

# Defining 'b' which will be the index number that the program will look at.
b = 1

# Creating 'r' to parse the input to whatever letter is next.
r = x [b]

# Defining n which will be used later to tell if the character is numeric.
n = 0

# Defining r1 which will hold one of the monomials, ( **will be replaced with a list**)

#This was the variable in question.
r1 = ''

# Setting 'p' to evaluate if R is numeric ( R and T explained above).
p = t(r)

# Setting 'n' to 1 or 0 to replace having to write True or False later.
if p == True:
    n = 1
else:
    n = 0

# Checking if r is one of the normal letters used in Algebra, and adding it to a variable
if r == 'x':
    v = 'x'
    c = 1
elif r == 'y':
    v = 'y'
    c = 1
elif r == 'z':
    v = 'z'
    c = 1

# If the character is a digit, set c to 0, meaning that the program has not found a letter yet (will be used later in the code).
elif n == 1:
    v = r
    c = 0

# Adding what the letter has found to a variable (will be replaced with a list).
r1 = r1 + v

b = b + 1

I will eventually make this a loop.

I added comments to the code so it’s more understandable.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T20:14:40+00:00Added an answer on June 12, 2026 at 8:14 pm

    Essentially, you are trying to programmatically, dynamically modify the heap space where the variables live. I really do not think this is possible. If it is, it is very obscure.

    I do understand where you are coming from. When I was first learning to program I had thought to solve problems in ways that would require such “dynamically created” variables. The solution really is to recognize what kind of (collection) data structure fits your needs.

    If you want variables a1 through a30, create a list a. Then a1 would be a[1], a30 would be a[30]. It is a little different to write, but it should give you the behavior you need.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So basically I'm making a program in C# and I need to make a
So basically I need to make feature that if you select something from first
For my project, I need to make a program that takes 10 numbers as
I'm trying to make an uninstaller. I basically need to be able to remove
I need to make a moderate system like the one in fmylife.com. Basically the
basically need to change the value that - admin_url() returns any idea?
Hello I am searching for a graph control that will allow me to make
How can Nginx serve crossdomain.xml file to a flash/flex program. Basically I need to
Hope you can help me with this one. I need to make a program
I need to create a web application that prints checks. Because of the nature

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.