As you are working on PA #2, I would like to offer some hints that you might find helpful. As you probably already find out, when converting a decimal value to its pentadecimal version, you need to keep accumulating pentadecimal values corresponding to the remainders. Moreover, in each iteration, you need to add the pentadecimal value for the current iteration right before the existing values.
I suggest that you try using string concatenation to achieve this goal. As discussed during the class, string concatenation allows you to combine two strings together. For example, let’s say we have two strings A=”Ilove” and B=”Python”, then A + B would give “IlovePython” and B + A would give “PythonIlove”.
Besides using the string concatenation technique to append the current pentadecimal value to existing values, please be aware that the pentadecimal value for 0 is still 0. Finally, please also keep these things in mind to avoid any grade penalty:
- Add sufficient documentation (e.g., comments, explanations, etc.) to your code
- Upload the original Python file and a word document with screenshots of your code and output


0 comments