python - How can you divide an input answer? -


im making calculator finds average of persons test scores eg: 16/20 + 17/20/2 im having trouble figuring out how divide users marks eg: if person enters 18/20, how divide it?

you split up:

numerator, denominator = '18/20'.split('/') decimal = float(numerator) / float(denominator) 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -