Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- """
- input output
- 5 artihmatic operation
- 5 kinds of data types
- 5 string manipulation
- """
- def splash():
- print " _ _ ____ _ "
- print "| | _ _ ___| | __ / ___|___ _ _ _ __ | |_ ___ _ __ "
- print "| | | | | |/ __| |/ / | | / _ \| | | | '_ \| __/ _ \ '__|"
- print "| |__| |_| | (__| < | |__| (_) | |_| | | | | || __/ | "
- print "|_____\__,_|\___|_|\_\ \____\___/ \__,_|_| |_|\__\___|_| by cv17-1"
- print "Let's count your luck!\n\n\n\n"
- def clear():
- for i in range(0,25):
- print ""
- def main():
- #1 boolean
- always = True
- #2 char
- letters = ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']
- clear()
- splash()
- while always:
- # input
- #3 string
- try:
- name = raw_input("What's your name? ")
- except:
- exit(2)
- if ' ' in name:
- #1 string manipulation
- name = name.split()
- #2 string manipulation
- name = "".join(e for e in name)
- #3 string manipulation
- words = len(name)
- #output
- print "Okay, you have a %d letters name" %(words)
- #1 arithmatic
- #4 integer
- mid = words/2
- #2 arithmatic
- if words%2 == 0:
- #4 string manipulation
- name = name[:mid]
- else:
- #5 string manipulation
- name = name[mid:]
- #6 string manipulation
- name = name[:-1]
- for i in letters:
- #7 string manipulation
- name = name.replace(i, 'k')
- #8 string manipulation
- name = name.upper()
- print "We change your name a bit into '%s' to check your luck today!" %(name)
- #9 string manipulation
- luck = name.count('k')
- #10 string manipulation
- if name.endswith('K'):
- print "Wow, such a beautiful name!"
- #5 arithmatic
- # / % + - * =
- #5 float
- luck = luck+10/4*2-1/words+mid+50.75
- print '_'*80
- #6 arithmatic >
- if luck > 100:
- luck = 100
- print "WoW! you've got " + str(luck) + "\x25 for your name!"
- main()
Add Comment
Please, Sign In to add comment