SHARE
TWEET

python program to calculate the sum

a guest Aug 22nd, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. alphabets = {'A': 1, 'B': 2,'C': 3, 'D': 4,'E': 5, 'F': 6,'G': 7, 'H': 8,'I': 9, 'J': 10,'K': 11, 'L': 12,'M': 13,'N': 14,'O': 15,'P': 16,'Q': 17,'R': 18,'S': 19,'T': 20,'U': 21,'V': 22,'W': 23,'X': 24, 'Y': 25,'Z':26}
  3.  
  4. g = raw_input("Enter your name : ")
  5. name=g
  6. name=name.upper()
  7. email="henricjames1@gmail.com"
  8.  
  9. sum=0
  10. for element in range(0, len(name)):
  11.     a=(name[element])
  12.     print(name[element])
  13.     print(alphabets[a])
  14.     sum=sum+alphabets[a]
  15.  
  16. print("the sum of the alphabets in your name is"+ str(sum))
  17.  
  18.  
  19.  
  20.  
  21. email = raw_input("enter your email : ")
  22. email=email.upper()
  23. email = email.replace("@", '')
  24. email = email.replace(".", '')
  25.  
  26.  
  27. sum=0
  28. for element in range(0, len(email)):
  29.     a=(email[element])
  30.     print(email[element])
  31.     print(alphabets[a])
  32.     sum=sum+alphabets[a]
  33.  
  34. print("the sum of the alphabets is your email is"+ str(sum))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top