The key here is to find the smallest number of bits to represent each state. We could use a letter mapping to spell out the name of every state. If we limited it to just capital letters and the full name, we would need 5 bits to represent all the letters. A state like OHIO would take 20 bits while CALIFORNIA would be be 50 bits. Even if we used only the 2 letter postal state code, each state would need 10 bits.
Imagine instead if we agreed on some way to rank the states and assign each state a number based on their rank. We could put them in alphabetical order, or in order by population or by date they entered the union, etc. ā as long as there is agreement. If we agree to rank by population size, California, as the largest, might be assigned 00001 and Wyoming, as the smallest, assigned 110010. Based on the agreement, which state would be 101000?
The point is ā no matter how we agree to rank them ā there are only 50 assignments to make and you only need 6 bits to represent 50 things. To go even further, it doesnāt matter what the things are. It could be books, cars, students or anything needing to be represented with the smallest number of bits. ahhhā¦ abstractionā¦!
Hi, Andrea. Would answer this question for me? I sent the following question to Code.org
Could you actually write down the number ā150ā in ASCII for me? U1 Lesson 7 doesnāt really explain. In Assessment for lesson 7 it says that in ASCII āevery character is encoded as one byte which is 8 bitsā, but this is not explained before. Now. I know that I need 24 bits. But, what is the actual format of ā150ā in ASCII?
The answer was:
Using the activity guide for this lesson you can look up each of the 3 characters in 150 to come up with 00110001 00110101 00110000
I had understood that the number 150 in ASCII was 49 53 48. Would you explain?
I think the confusion might be that ASCII is a system for encoding text where each character corresponds to a code. This is why we want to specify which number system we are using if we wanted to get the ASCII number equivalent. For example if we wanted to know how the word āAppleā translated into its ASCII number equivalent, we would want to specify what number system we were using.
It would be better to say āThe word āAppleā translated into its ASCII number (decimal) equivalent is 065 112 112 108 101ā
We could also say what it āAppleā is in its ASCII number (binary) equivalent by changing each of those decimal numbers to binary which would be 01000001 01110000 01110000 01101100 01100101
Both of these are accurate representations of the word āAppleā only one is using the binary number system and the other is using a decimal number system.
This is similar to your question - the answer you recieved was looking at the 3 characters binary equivalent in the ASCII system. Your answer looked at the decimial equivalent in the ASCII system.
Also, could you help me understand where you saw the question āWrite down the number 150 in ASCII?ā in the lesson? I wanted to make sure that the directions are accurate but I couldnāt find it when I was looking through the āChecks for understandingā.
We are talking about a question that I asked to Code.org. I just want to make sure I have the correct answer. Am I correct if I say that the number 150 translated to ASCII is 49 53 48?
I understand that ASCII is a system for encoding text, but the ASCII chart also shows that you can encode numbers 0,1,2,3ā¦9
Because the chart did not show other numbers, I wanted to know how I can encode other numbers that go beyond the ten digits. I didnāt know if the ASCII system uses the idea of place value, for example.
So. I just want to know how to translate other numbers to ASCII, like: 87, 134, 15, 1253, etc. Any number that is not one of the digits.
I am always talking of numbers in base ten.
The question of ābetterā is a great discussion to have with students. It reinforces the importance of protocols and the challenges of communication. ASCII has become a standard but it is not the only one and it wasnāt always as universal as it is today. The ASCII table is not sent as a key because everyone would have access to the table in advance. To connect it to the states example, the list once determined and agreed upon would not have to be shared every time ā it would be the standard and available in advance.
You have correctly represented the number 150 in ASCII but it is important to note that this is the characters not the values. Each of the ASCII values would then need to be converted into binary. So, 00110001 is the binary equivalent of the decimal 49. Because it āknowsā ASCII, a computer would be able to print ā150ā with the binary sequence - 00110001 00110101 00110000 - but could not, without some additional steps, do any calculations. The binary equivalent of the decimal value 150 is 10010110. Note that it can be stored in 8 bits as value but it would take 3 times as many bits to store it as ASCII characters.