How can I find if user input is inclusive in list of arbitrary integers in Python 3.3.0 -


Here is some code for a function that is writing to me, giving output whether a given date is valid or not:

  date = (input ("Enter a date (dd / mm / yyyy):") monthStr, dayStr, yearStr = date.split ("/") monthStr = integer (monthStr) ) DayStr = integer (DayStr) yearStr = int (yearStr) Mylist1 = [1, 3, 5, 7, 8, 10, 12]   

So I want to make another statement which That way, but I do not know the syntax or method:

  if monthStr (== is one of the integers in mylist) ("Valid date") other: print ("not valid date")    
  if the monthStr (0, 32) in Mylist1 and dayStr in the range: print ("valid date") and: "postprice" itemprop = "text" Print ("a valid date")   

Although your variable names are not very good, you do not really have a string, because you have more relevant names. needed.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -