2021年3月5日星期五

Validate if its a string or not

I am not getting it right and I can't find how to do it.

Get the user input and create a thematic list of strings. The program should ask for a specific input theme. The user should enter strings for the list until a condition is met such as entering a specific word or character. There should not be hard coded list size.? Each user input should be one list element.

MyList = []    for _ in range(5):      planets = str(input("Enter 5 planets: "))      if planets == str(planets):          if planets not in MyList:              MyList.append(planets)      else:          print("Input not valid")    print("That's your planets: ")  print(str(MyList))  
https://stackoverflow.com/questions/66501758/validate-if-its-a-string-or-not March 06, 2021 at 10:20AM

没有评论:

发表评论