3 ms·
If you don't need other bases you can just string join them. : P
by bpicolo 12y ago
If you don't need other bases you can just string join them. : P
- TheLoneWolfling 12y agoThat's actually how I started, and `int` has a base parameter. But it's still relatively verbose, due to Python's whole "join-only-takes-strings" thing: def valueOf(*values, base=10): return int("".join(map(str, values)), base=10) Not to mention it's doing a whole lot of unnecessary work.
- TheLoneWolfling 12y agoWhoops. Miscopied. the second `=10` shouldn't be there.