0

I feel like I'm missing something, I'm quite new to Python and I have a questionnaire which essentially asks the user to input the same type of information numerous times, but I obviously cannot use mutation since it is not allowed in Python (of which I might be wrong). If I have say 5 'refNames' it seems too repetitive, now is there a function that I could define that will clear the previous refName input?

refName_1, refSurname_1 = input('Who is your first reference: ').split()
refNames_1 = '{} {}'.format(refName_1.capitalize(), refSurname_1.capitalize())
refName_2, refSurname_2 = input('Who is your second reference: ').split() 
refNames_2 = '{} {}'.format(refName_2.capitalize(), refSurname_2.capitalize())

print(refName_1)
print(refName_2)
Roy Levy
  • 640
  • 1
  • 11
  • 24
zerid N
  • 3
  • 1
  • [How do I create a variable number of variables?](https://stackoverflow.com/questions/1373164/how-do-i-create-a-variable-number-of-variables) – Sayse Mar 10 '20 at 09:11
  • If you need the refNames for future uses other than printing them, you could use a list and save them all by doing it in a loop. This way you wouldn't need to repeat the same code lines over and over again. – Roy Levy Mar 10 '20 at 09:17

0 Answers0