# Tag Info

Accepted

### Convert Persian and Arabic digits to English

Be nice to the maintenance programmer, even (especially?) if you expect it to be you. If you're mixing characters which are visually indistinguishable but don't need to be literal self-representations,...
• 24k
Accepted

### Binary to decimal converter

What would Bob do? You've written an interactive program, but the user does not know what your program does. Therefore, Bob—the generic user—might accidentally write "test" instead of a ...
• 19.1k
Accepted

### C++ basic bank money class

Store Money as Fixed-Point Monetary quantities are the classic example of something that might have fractional values, but you do not want to represent as a floating-point number, because you need ...
• 3,456
Accepted

### Arabic to Greek numeral converter, 1 - 10

It's great to see that you're using strict mode for strict compliance (which should really be the default), however you shouldn't use strict mode the way you are now. You've probably seen strict mode ...
• 3,753

### Arabic to Greek numeral converter, 1 - 10

Reviewing your current structure: your return ""; could be improved: it should / could be inside the switch statement as a ...
• 11.9k

### Arabic to Greek numeral converter, 1 - 10

That looks like a classic case for a lookup table. This function should be a one-liner. We know that parameters are inputs. What kind of input? Also, the input isn't Arabic; it's just abstractly a ...
• 143k
Accepted

### Represent integer as binary in C

More specific types are available for an eight bit number, such as uint8_t static keyword is dangerous (when used as an output ...
• 1,612

### Hex to Decimal converter

static String hexRep = "0123456789ABCDEF"; Imagine if I put some code in the same package and did HexToDecimal.hexRep = ""; ...
• 58.7k
Accepted

### The base-ten value of n-base number with Python

A few quick comments: Use a proper function here, not a lambda. It’s generally more readable, and should be preferred unless you’re writing a ~very short function. And then use different variable ...
• 8,475

### Karazuba Algorithm with arbitrary bases

Combine division and modulus Use https://docs.python.org/3/library/functions.html#divmod rather than this: digits.append(int(n % b)) n //= b Replace ...
• 55.5k
Accepted

### Implementing my own Integer.toBinaryString(int n) method

The exercise calls for bit shifting. Only bit shifting, nothing else, really. Your main tools are: checking if the last bit is 0 or 1 with: num & 1 then shift ...
• 110k
Accepted

### Integer to binary using an old-school way

Functional extraction Your method does not do toBinary, it does: read input from user convert to binary print back for user When you have methods that do ...
• 97.1k
Accepted

### Base 26 (letters) and Base 10 using recursion

As others already said, recursion doesn't quite fit here. But I’d say it doesn't fit because strings are immutable. In your implementation, you are either concatenating strings or slicing them, which ...
Accepted

### Hex dump of a list of 16-bit numbers

Here are some comments on your code: I assume the structure of the input data is to be taken as it is: one long list where only the 1 out of 8 values contribute to the output. ...
• 557
Accepted

### Convert decimal to binary

Terminology It's important to be able to understand (and describe) what's actually going on. Your program converts from an integer decimal string representation to an integer using ...
• 55.5k

### Hex to Decimal converter

To get a normal integer from a hex string you can use the built-in Integer.parseInt(String, int) which simplifies things to Integer.parseInt("AB", 16); The actual ...
• 12.8k

### Roman Numeral class in Python

I do not really know how you plan to use your RomanNumeral object. From what's in the constructor, I guess you'd use it to convert a string corresponding to a ...
• 29.1k

### Convert binary string to decimal number

Well, first of all the description is wrong. strbin_to_dec() should be strbin_to_i(), because it parses a base-2-number, instead ...
• 18.4k
Accepted

### String to binary converter

I would change ...
• 288

### Represent integer as binary in C

Bug Code attempts to form a string. Yet it lacks a terminating null character and space for it. // static char binary[10]; static char binary[11]; As a ...
Accepted

### All-in-one number base converter

A couple of simplifications are possible that will make this code more Pythonic. Instead of declaring an empty number = [] and then appending elements, use a list ...
• 110k

### Hexadecimal number to decimal conversion

To take a quick first stab at some style issues: Follow a consistent indentation style. This makes the code extremely readable, and you will thank yourself later when you come back to your code. For ...
• 458
Accepted

### Function to convert a decimal number as a string to hexadecimal

Code Review. If this is a set of constants you want to chech against then it should by marked as constexpr (or const), that way nobody can actually modify it. ...
• 92.9k

### Convert Persian and Arabic digits to English

You can use capture groups return string.replace(/([٠١٢٣٤٥٦٧٨٩])|([۰۱۲۳۴۵۶۷۸۹])/g, function(m, $1,$2) { return m.charCodeAt(0) - (\$1 ? 1632 : 1776); }); <...
• 2,964
Accepted

### Convert boolean list to list of base10 integers

The individual steps that you describe in the Problem section are each simple and easy to follow. Yet you write your code in basically a single line. To understand it I had to tear it apart like you ...
• 21.1k

### Decimal to Binary in Rust

isn't it better to write input as a macro ? No. At best it might work as a generic function. how can i write to_binary as pure function ? It already is a pure function, it doesn't mutate or ...
• 29.6k
Accepted

### Python binary calculator

General design comment The fact that a binary number needs to access the application using it looks like a huge design issue. A quick fix for this is to provide the desired numbers of bits instead - ...
• 29.1k

### Converting long values in Java to unsigned strings

Since you're asking about readability, let's take a look at that. Your functions and variables could be named better. Especially parts like this: ...
• 13k