This morning I woke up and was in a great mood for some programming. Thanks to finding a Google tutorial, I finally gave Python a serious look over and I'm glad I did. It's a really powerful language.
Check it out if you haven't seen it yet!
So without further ado, here's what I managed to make today (I've also completed the exercises in Google's site).
Keep in mind, I'm learning Python here and these things will probably seem trivial to most.
But I did say I was going to complete the Mega Project List or die trying. So here goes nothing:
1. Reverse A String
2. Count The Vowels In A String
3. Count The Words In A String
4. Check If A Word Is A Palindrome
5. Translate A Sentence To Pig-latin.
That's it for today. Tomorrow I'll get crackin' on a few more, but those will probably take a bit more time as they are GUI applications. Thanks for checking this post out.
Check it out if you haven't seen it yet!
So without further ado, here's what I managed to make today (I've also completed the exercises in Google's site).
Keep in mind, I'm learning Python here and these things will probably seem trivial to most.
1. Reverse A String
word = raw_input("Please enter your string to reverse: ")
print word[::-1]
2. Count The Vowels In A String
word = raw_input("Please enter your sentance: ")
counter = 0
for letter in word:
if letter.lower() == "a" or letter.lower() == "e" or letter.lower() == "i" or letter.lower() == "o" or letter.lower() == "u":
counter += 1
print "There were " + str(counter) + " vowels in your input."
3. Count The Words In A String
sentence = raw_input("Enter your string, and I'll count the words: ")
wordList = sentence.split(" ")
print "There are " + str(len(wordList)) + " words in your sentence."
4. Check If A Word Is A Palindrome
word = raw_input("Please write in the word you want to check for palindrome: ")
if word == word[::-1]:
print "Yes, it's a palindrome."
else:
print "No, not a palindrome."
5. Translate A Sentence To Pig-latin.
sentenceToTranslate = raw_input("Please write in the sentence you want to translate: ")
words = sentenceToTranslate.split(" ")
pigWords = []
def isVowel(letter):
return letter.lower() in ['a','e','i','o','u']
for word in words:
if isVowel(word[0]):
tempWord = word + "way"
else:
tempWord = word[1:] + "-" + word[0] + "ay"
pigWords.append(tempWord)
print tempWord,
That's it for today. Tomorrow I'll get crackin' on a few more, but those will probably take a bit more time as they are GUI applications. Thanks for checking this post out.
1 Comments On This Entry
Page 1 of 1
Page 1 of 1
Trackbacks for this entry [ Trackback URL ]
My Blog Links
Recent Entries
-
Completed some more projects off the Mega Project List on DIC.on Mar 21 2010 05:13 PM
-
Recent Comments
-
comptechexpert
on Mar 26 2010 10:24 AM
Completed some more projects off the Mega Project List on DIC. -
Search My Blog
1 user(s) viewing
1 Guests
0 member(s)
0 anonymous member(s)
0 member(s)
0 anonymous member(s)
|
|



1 Comments









|