def AddSingleCard(self):symbols = ['heart', 'diamond', 'club', 'spade']#newCardSign = ''newCardNumber, newCardSign = raw_input().split()try:newCardNumber = int(float(newCardNumber))except:newCardNumber, newCardSign = raw_input().split()while (newCardNumber not in (2,15) or newCardSign not in symbols):newCardNumber, newCardSign = raw_input().split()newCard = [newCardNumber, newCardSign]
I'm trying to loop until the input will be a number between 2-15, and the string will be one of the symbols, but the while loop works for me only if the wrong input is the numbers, if the numbers are in range and the string is not, the program just gets stuck in the while line, and waits for next input, instead of going down to the next line and get the input to the right place... I believe it's connected to the syntax of my while loop, but I can't put my finger on the problem. (my programming background is c, I'm new to python)
tnx!