-5

How to use it? I have tried to run the code found as solution on codewars:
codwars solution

but I get error:

TypeError: translate() takes exactly one argument (2 given)

In documentation I have found it takes argument table which is mapping or sequence. (what is it?!)
To create it I can use maketrans() but how to put None there when as second argument it needs string with equal length?

tabl = string.maketrans("aeiouAEIOU", "          ")
string = string.translate(tabl)

I programme in Java and R and I must admit that python is very messy language.

keepAlive
  • 6,369
  • 5
  • 24
  • 39
stakowerflol
  • 979
  • 1
  • 11
  • 20

1 Answers1

1

In Python 2 translate accepted 2 arguments, in Python 3 it only accepts one.

Alex Hall
  • 34,833
  • 5
  • 57
  • 89
  • 2
    @stakowerflol the difference is that this was a major version change, which typically is backwards incompatible in software. Java has never had a major version change, it's still on 1.X. This has left a lot of warts hanging around in the language. – Alex Hall Jan 28 '19 at 09:06
  • 1
    Technically, the Java version you see increasing the minor version number (i.e. 1.7 -> 1.8 -> 1.9). Minor version numbers imply no API breaking changes. Similar to Python 2.6 -> 2.7. Python 2.x to 3.x is a Major version change, and therefore is allowed have API breaking changes. – Thomas D Jan 28 '19 at 09:07