Skip to content

Instantly share code, notes, and snippets.

@RomelSan
Created August 20, 2020 20:59
Show Gist options
  • Save RomelSan/fcfac27d71e151360597eb95caa29cd7 to your computer and use it in GitHub Desktop.
Save RomelSan/fcfac27d71e151360597eb95caa29cd7 to your computer and use it in GitHub Desktop.
Magic of Math in Language
# Magic of Math in Language
# v2.0 by @RomelSan (August 20, 2020)
#Functions
def sum_digits(n):
# Sum numbers until it is 1 digit
if n > 0:
s = (n-1) // 9
return n-9*s
return 0
def sum_name(name_digits):
# Sum numbers but it can show upto 2 digits
total = 0
while(name_digits>0):
dig = name_digits%10
total = total+dig
name_digits = name_digits//10
return total
# End Functions
name = input("Enter your full name:")
name_low = name.lower()
sum = 0
magicNumbers= {
"a": 1,
"b": 2,
"c": 3,
"d": 4,
"e": 5,
"f": 6,
"g": 7,
"h": 8,
"i": 9,
"j": 1,
"k": 2,
"l": 3,
"m": 4,
"n": 5,
"o": 6,
"p": 7,
"q": 8,
"r": 9,
"s": 1,
"t": 2,
"u": 3,
"v": 4,
"w": 5,
"x": 6,
"y": 7,
"z": 8,
" ": 0
}
for character in name_low :
char_x = magicNumbers.get(character)
print (character + " = " + str(char_x))
sum = sum + char_x
print("Name Sums: " + str(sum))
total = sum_name(sum)
print("Your Result is: " + str(total))
single_digit = sum_digits(sum)
print("Your Magic Number is: " + str(single_digit))
planet_dict= {
1: "SUN",
2: "MOON",
3: "JUPITER",
4: "RAHU (North Node of the Moon)",
5: "MERCURY",
6: "VENUS",
7: "KETU (South Node of the Moon)",
8: "SATURN",
9: "MARS",}
planet_x = planet_dict.get(single_digit)
print(planet_x)
input('')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment