[ create a new paste ] login | about

Link: http://codepad.org/Emzpix3H    [ raw code | output | fork ]

ledpepper - Python, pasted on May 27:
#Enter in firstname.lastname (bob.smith)
#Count the amount of letters(x) and vowels(y)
#Then work out if bob is > but not equal to 6 letters
#If firstname is less than 6 print firstnamesurnamexy
#If firstname is equal to or greater than 6 print firstnamexy
#Copy result to clipboard

import os, sys
import win32clipboard as wc
import win32con

#Save to clipboard
def clipboard(msg):
   if sys.platform == 'win32':
      wc.OpenClipboard()
      wc.EmptyClipboard()
      wc.SetClipboardData(win32con.CF_TEXT, msg)
      wc.CloseClipboard()      

first_last = raw_input("Please enter a phrase: ")

#Count the number of letters
letters = 0
for letter in first_last:
    if letter in "abcdefghijklmnopqrstuvwxyz":
        letters += 1

#Count the number of vowels
vowel = 0
for letter in first_last:
  if letter in "aeiou":
        vowel +=1

#Count the letters of the first name
#This should include an if less than 6 do first_last


#Delete everything after and including the .
split = first_last.split(".")[0]

#Concatenate results onto one line
result = split + str(letters) + str(vowel)

#Print and copy result to clipboard
print result
clipboard(result)

raw_input("Result copied to clipboard. Press Enter to finish")


Output:
1
2
3
4
Traceback (most recent call last):
  Line 9, in <module>
    import win32clipboard as wc
ImportError: No module named win32clipboard


Create a new paste based on this one


Comments: