No Leading Zeros – Design of Computer Programs


In this homework assignment, I want you to modify the function compile.formula so that it rejects any formula where there is a zero as the leading digit in a word. Now, in our first version of solve we took care of that, and we had to because Python would have interpreted 012 as an octal number. In the second version where we use compile.formula, we didn’t work about that. Now we want to put that test back in. If YOU is a word in the formula and the function is called with Y equals 0, the function should return False, even if the arithmetic works out. What I want you to do is modify the following code in any way you want, so that the function that you build up as a string and then compile with a vowel is a function that will correctly return false in this case.

Leave a Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © 2019 Geted Tabs Online. All rights reserved.