Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using Python Classic numerology ascribes meaning to the following numbers: 0 = e

ID: 3760127 • Letter: U

Question

Using Python

Classic numerology ascribes meaning to the following numbers:

0 = emptiness, nothingness, blank

1 = independence, loneliness, creativity, originality, dominance, leadership, impatience

2 = quiet, passive, diplomatic, co-operation, comforting, soothing, intuitive, compromising, patient

3 = charming, outgoing, self expressive, extroverted, abundance, active, energetic, proud

4 = harmony, truth, justice, order discipline, practicality

5 = new directions, excitement, change, adventure

6 = love, harmony, perfection, marriage, tolerance, public service

7 = spirituality, completeness, isolation, introspection

8 = organization, business, commerce, new beginnings

9 = romatic, rebellious, determined, passionate, compassionate

11 = idealism, visionary, inspirational

12 = perfectionist, discriminating

22 = builder, leader, humanitarian, practical, honest

However, you might recall from the previous problem that the sample input ("craig") reduced to the number 38. 38 is not on the "personality trait" lookup table above, so we need to further reduce the number by adding up its individual digits like so:

The number 11 is on the personality traits table, so we can print out to the user what their traits are based on this number.

Note that it might take a few tries to reduce the user's number to a number that is on the personality trait listing. You might want to think about building in a loop that handles this process.

Here are a few sample runnings of this program:

Some hints:

Attempt to reduce the user's name one time before you attempt to further reduce it (i.e. my name reduces to 38 the first time – get your name to reduce like this as well, and don't worry about further reducing the name until you understand how to do it the first time)

Try to use the ord() function to convert a single character into its ASCII equivalent. This should help in the conversion process.

Once you have reduced the name you should test to see if it is one of the "special" numbers listed above. If so, tell the user what their traits are and end the program.

If the number is not one of the numbers above then you need to further reduce it. Hint: this should be done using a "while" loop to ensure that you reduce the number as far as it can go.

Explanation / Answer

import re

person = input('Name: ')
person=re.sub('[^a-zA-Z0-9-_*.]', '', person)
person=person.lower();
print('Your 'cleaned up' name is: ', person)
total=0
for letter in str(person):
total+=ord(letter)
while (total):
if(total==1):
print('Your name reduces to....1 -Independence!')
break
if(total==2):
print('Your name reduces to....1 -Quiet!')
break
if(total==3):
print('Your name reduces to....3 -Charming!')
break
if(total==4):
print('Your name reduces to....4-Harmony!')
break
if(total==5):
print('Your name reduces to....5 -New Directions!')
break
if(total==6):
print('Your name reduces to....6 -Love!')
break
if(total==7):
print('Your name reduces to....7 -Sprituality!')
break
if(total==8):
print('Your name reduces to....8 -Organization!')
break
if(total==9):
print('Your name reduces to....9 -Romantic!')
break
if(total==0):
print('Your name reduces to....0 - Emptiness!')
break
if(total==11):
print('Your name reduces to....11 - Idealism!')
break
if(total==12):
print('Your name reduces to....12 - Perfection!')
break
if(total==22):
print('Your name reduces to....22 - Builder!')
break
if(total>11):
total=sum(int(x) for x in str(total))
print('Reduction:' ,total)
  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote