Is there a way to use sys.argv directly to define the upper limit of a for loop in Python? I hope I'm using the right terminology. I don't have a lot of experience writing code, and I'm very new to Python. What I mean is that when I try this:
Code:
for x in range(1,len(sys.argv):
Code:
File "./dice.py", line 13 for x in range(1,(len(sys.argv)): ^ SyntaxError: invalid syntax
Code:
y = len(sys.argv) for x in range(1,y):
Code:
for $x (1..$#ARGV) {
Using len(sys.argv) directly to define a for loop in Python
Aucun commentaire:
Enregistrer un commentaire