My program states "not all arguments converted during string formatting"
Go to solution
Solved by Mijnay,
Don't forget to use the forum's code tag:
a =1 while a==1: Numcas = int(input("How many cases do you have?: ")) countcas = 1 state = a = input('Enter the amount of columns and rows in your game: ') h = a.split(",") coltotal = int(h[0]) rowtotal = int(h[1]) if (2<=coltotal<=1000 and 2<=rowtotal<=1000): while (countcas <= Numcas): question2 = 'Enter the starting position in the case #{}: ' positionst = input(question2.format(countcas)) position = positionst.split(",") colstart = int(position[0]) rowstart = int(position[1]) question4 = 'Enter the finishing position number in the case #{} ' positionend= input(question4.format(countcas)) positionen = positionend.split(",") colend = int(positionen[0]) rowend = int(positionen[1]) countcas+=1 seqcount = 1 if positionst[0] % 2 == 0 and positionst[1] % 2 == 0 and positionend[0] % 2 ==0 and positionend[1] % 2 ==0: print ("TRUE") if positionst[0] % 2 !=0 and positionst[1] % 2 !=0 and positionend[0] % 2 !=0 and positionend[1] % 2 !=0: print ("TRUE") if positionst[0] % 2 !=0 and positionst[1] % 2 ==0 and positionend[0] % 2 !=0 and positionend[1] % 2 ==0: print ("TRUE") if positionst[0] % 2 ==0 and positionst[1] % 2 !=0 and positionend[0] % 2 ==0 and positionend[1] % 2 !=0: print ("TRUE") else: print ("FALSE")
The issue is that positionst and positionend are strings. This causes the % operator to be interpreted as string interpolation. You probably want to replace positionst[0] with colstart, positionst[1] with rowstart, etc... Those are your integers which will have % do the modulus operation like I think you are expecting.
Feel free to ask more questions.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now