Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

While loop change variables

I need to change the text in the variable after one round of the cycle.
Like first round of loop a="A", second round a="B".

a = ("A")
a1 = ("B")
a2 = ("C")
a3 = ("D")
a4 = ("F")

i = 0
while i < 5:
    print(a)
    a += 1
    i += 1

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Put the values in an array and access the values:

a = ['A', 'B', 'C', 'D', 'E']

i = 0
while i<5:
    print(a[i])
    i = i+1
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading