Jun-23-2022, 07:34 PM
Hello,
I am relevant new to the language Python. However, I can code in PHP and VBA and other languages so I am not a total beginner.
I am wondering how I can create a Loop that goes one by one
So Instead of just printing out the whole loop as this one does:
The car Ford has been sold
The car Volvo has been sold
The car BMW has been sold
Thanks in advance!
I am relevant new to the language Python. However, I can code in PHP and VBA and other languages so I am not a total beginner.
I am wondering how I can create a Loop that goes one by one
So Instead of just printing out the whole loop as this one does:
cars = ["Ford", "Volvo", "BMW"] for x in cars: print(x)How do I do so it does like this:
cars = ["Ford", "Volvo", "BMW"] for r = 1 to 3 variable(r) = "The car cars(r) has been sold" Next r Print("out all variables (should be 3 if the loop finnish)")Results:
The car Ford has been sold
The car Volvo has been sold
The car BMW has been sold
Thanks in advance!