Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialrobertdorgan
5,944 PointsWhat does completed Python script look like?
Where can I find a completed script of Python code (for like a functioning app or something)? I know none of it would make sense to me right now. However, I feel like getting a glimpse of what Iām working towards would help me understand the steps along the way better.
1 Answer
rydavim
18,814 PointsYou can find tons of code snippets and demo apps for python, ranging from simple beginner programs to complex API tools. Here are some quick examples.
# Temp Converter - pythonfiddle.com/temperature-convert-program/
Celsius = int(raw_input("Enter a temperature in Celsius: "))
Fahrenheit = 9.0/5.0 * Celsius + 32
print "Temperature:", Celsius, "Celsius = ", Fahrenheit, " F"
# Pig Latin Translator - pythonfiddle.com/pig-latin-translator-for-python/
#Take the users input
words = raw_input("Enter some text to translate to pig latin: ")
print "You entered: ", words
#Now I need to break apart the words into a list
words = words.split(' ')
#Now words is a list, so I can manipulate each one usinga loop
for i in words:
if len(i) >= 3: #I only want to translate words greater than 3 characters
i = i + "%say" % (i[0])
i = i[1:]
print i
else:
pass
There are also some good intermediate examples like Python Tweet Search and a Python Hangman Game.
You can find many more on the Python for Beginners code examples page.
Hopefully that helps. Good luck, and happy coding!