python - using a loop, while using a variable to set how many times it loops -
def searchqueryform(alist): noforms = input("how many forms want search for") in range(noforms): searchquery = [ ] nofound = 0 ## no found set @ 0 formname = input("pls enter formname >> ") ## asks user formname formname = formname.lower() ## converts lower case row in alist: if row[1].lower() == formname: ## formname appears in row2 searchquery.append(row) ## appends results nofound = nofound + 1 ## increments variable if nofound == 0: print("there no matches") return searchquery
i trying use variable set how many times loop occurs. have tried set entering variable. keep getting error
typeerror: 'str' object cannot interpreted integer
cast user input. int
instead of string
:
noforms = int(input("how many forms want search for"))
Comments
Post a Comment