[Tutor] Roman Numeral - To - Digital Converter
Luke Paireepinart
rabidpoobear at gmail.com
Mon Mar 12 03:45:21 CET 2007
Alan Gilfoy wrote:
> Roman Numeral - To - Digital Converter
>
> So far, I'm coming along OK with the code that runs the conversions,
> assuming the user gives me a proper input. (A string of capital
> letters I, V, X, L, C, D, M)
>
> However, not every input someone gives the function is goign to be
> properly formatted like that.
>
> So:
>
> 1. How do I have my function "screen" an input string for characters
> that aren't I,V,X,L,C,D or M?
> 2. If any of the characters in the string are merely lowercase
> i,v,x,l,c,d, or m, how would I tell Python to capitalize those and go
> on with working the function?
>
>>> 'heLlo'.upper()
'HELLO'
>>> print 'i' in 'hilly'
True
>>> print 'i' in 'holy'
False
I hope that gives you some clues.
-Luke
More information about the Tutor
mailing list