First off, I know that to set an indexed variable, say, mylist[3] = "Hello". I also know that you wouldn't be able to set mylist[3] if you didn't first state:

mylist = ["Whatever", "Whatever", "Whatever", "Whatever"]

But, if you had a variable with an extremely large index, it would be a pain in the rear to type " "Whatever", " that many times.

So, my question is, is there a not-tedious way to do this? Like Ruby's mylist = "Whatever" * 100?

Thanks in advance.

Recommended Answers

All 2 Replies

this way

mylist = ["whatever"] * 100

Problem solved. Thanks a lot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.