0

Why can't this work in python 3

roman numeral challenge works in 2.7 https://code.sololearn.com/c2rGsc1VAKYE/?ref=app

23rd Jun 2018, 4:48 AM
Matt P Dk Wzb
Matt P Dk Wzb - avatar
4 Antworten
+ 12
I found the following: 1. Missing parenthesis in line 56 2. Wrong operator in line 8 - should be // 3. Wrong division operators throughout the code - should all be floor division operators which are // in Python 3 4. Wrong 900 literal - should be "cm" 5. Wrong logic of if statements - doesn't work properly for 1410 for example -- change line 21 to fix that 6. Wrong 40 literal - should be "xl"
23rd Jun 2018, 5:16 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 3
This does work: outstr += (v//5 * "v") I was missing an end bracket on the line before print. I don't understand why your input has to end with a zero. And I don't understand why the last line asks for input again.
23rd Jun 2018, 5:12 AM
Paul
Paul - avatar
+ 3
This can also work: outstr += (int(v/5) * "v")
23rd Jun 2018, 5:16 AM
Paul
Paul - avatar
+ 1
thanks for the prompt answers.. thejump from from 2.7 is a big change. isnt it backwards compatible
23rd Jun 2018, 5:20 AM
Matt P Dk Wzb
Matt P Dk Wzb - avatar