Advertisement
earlution

Validation with list comprehension

Nov 4th, 2021
1,228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. choices = ("P3",
  2.            "P5",
  3.            "P7",
  4.            "16GB",
  5.            "32GB",
  6.            "1TB",
  7.            "2TB",
  8.            "19\"",
  9.            "23\"",
  10.            "Mini Tower",
  11.            "Midi Tower",
  12.            "2 ports",
  13.            "4 ports")
  14. processors = [processor.lower() for processor in choices[:3]]
  15. while processor_choice.lower() not in processors:
  16.     print("That is not a valid choice.")
  17.     processor_choice: str = input("Please choose again: ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement