# heres the problem how can i manipulate just row = to get the aproiate response
position = 'cd'
col = position[0]
row = int(position[1])
if col in ['a','A','b','B' ,'c','C','d','D ','e','E','f',' F','g','G','h', 'H'] and row in [1,2,3,4,5,6,7,8]:
print 'The piece is moved to %s%s.' % (col,row)
elif col not in ['a','A','b','B' ,'c','C','d','D ','e','E','f',' F','g','G','h', 'H'] and row in [1,2,3,4,5,6,7,8]:...
User Profile
Collapse
-
int input
sorry but this is probably a stupid question but;
if you have an input like
pos = 'c3'
#and you want to take out the second character as an int what do you need to add to stop it from producing an error if the second character is a letter
eg. pos = 'cd'
# i've been using
int(pos[1]) # but it gives an error when the [1] is a letter not a number. -
how to remove space
hey i've only just started using python so i'm not to good at it but how do you remove the spaces in a print out like this
col = b
row = 2
print 'the position is',col,row,'.'
the position is b 2 .
#those spaces between the b the 2 and the .
No activity results to display
Show More
Leave a comment: