0

I wrote a program which displays user name and prints its length in java. Ported the same program in Python.

Look at the amount of code reduction in Python. Almost 50%. https://code.sololearn.com/cxWjZ374XuCt/?ref=app https://code.sololearn.com/c9EyqA2da1TP/?ref=app

5th Jul 2017, 2:45 PM
suryapoojary
suryapoojary - avatar
1 Antwort
+ 4
Note anymore! 😜 https://code.sololearn.com/c3tj76edDkX8/?ref=app Also keep in mind writing a single line of code is not equivalent to running one line of code. For example, (In java) String1.equals(String2) This is O(n), where n is the smaller strings length + 1. Meaning that's how many lines of code will be run (Whatever O(String.length() + 1) is. (Just saying that since that's what Python does with the global functions). But yeah, Java aint gonna keep up with Pythons shortness. PS: In your Python code you have 2 un-used variables. letter and letter2.
5th Jul 2017, 3:53 PM
Rrestoring faith
Rrestoring faith - avatar