Question: 3. Four is magic. Write a Python program (called q3.py) that given an integer from 0 to 1,000 does the 4 is magic transformation. The

 3. Four is magic. Write a Python program (called q3.py) thatgiven an integer from 0 to 1,000 does the "4 is magic"

3. Four is magic. Write a Python program (called q3.py) that given an integer from 0 to 1,000 does the "4 is magic" transformation. The steps are as follows. a) Convert the integer n into English and count the number of letters (i.e. 21 is "twenty one" and consists of 9 letters, 102 is "one hundred two" and consists of 13 letters, 1000 is "one thousand" and consists of 11 letters). b) Let nien be the length of the English word equivalent for the integer n. . If nlen is 4, output "four is magic." Then, terminate the transformation pro- ii. Otherwise output "English word equivalent of integer n> is nlen." Re- Suppose the user inputs the integer 26. Then, the transformation proceeds as follows. twenty six is 9., where twenty six is the 9-letter English word equivalent of 26. cess. peat step (a), where the integer n is set to nien | nine is 4J, where nine is the 4-letter English word equivalent of 9. . four is magic

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!