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 trial

Python Python Basics Functions and Looping Expecting Exceptions

Manuel Canario
Manuel Canario
1,458 Points

How can I get the same program or code that the teacher is working on the video?

I want to open the same program or script he is working on the video to keep up with the explanations. Usually, I have to stop the video at the beginning and rewrite the code he has in the video to make the explanations easier to comprehend.

3 Answers

akoniti
akoniti
1,410 Points

To me, transcribing the code they're writing to test it yourself is just part of the learning process. Typing the code helps cement the syntax in your mind, and helps speed up your typing too :) The more you do it, the better able you'll be to keep up with the instructors, and the more familiar you'll be with the syntax, functions, methods, etc...

just launch the workspace and you will get the code in a workspace where you can edit or run the code shown in the video

gabrielle moran
gabrielle moran
1,985 Points

I launched a workspace from under the video I was watching, as instructed, but none of the script was in it. I don't understand why, because the videos telling us how to use workspaces say it will be all there preloaded. There is only so much transcribing I want to do, though I get what you're saying akoniti

gabrielle moran
gabrielle moran
1,985 Points

Okay... I was just being dense. It is there, in a file that was not open yet and I didn't bother to look in it. Must be time for a coffee! Manuel Canario, you should find and watch the video series on using workspaces - all will be revealed.

lenielson sousa
lenielson sousa
2,739 Points

Just create a new file and try to create the function again. It is the best way to learn it. Otherwise, you will be stuck with tutorials. In any case, if you still need a snip of the code

--- it isn't the same as the teacher but it does the same thing ---

import math

def split_check(total, number_of_people): """This function split the total of a bill in a party """

result = math.ceil(total / number_of_people) return f"The total for each person will be {result}"

try: total_due = float(input("Enter the total: ")) number_of_people = int(input("Enter the number of people: ")) except ValueError: print("Oh no! Please enter a correct value. Try again!")

else: amount_due = split_check(total_due,number_of_people) print(amount_due)