Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics All Together Now Wrapping Up

Szymon Dabrowski
Szymon Dabrowski
2,161 Points

Not a Question but Praise

I'd like to thank Treehouse and Craig Dennis for this course. I have learnt many useful skills with the way content is provided on treehouse. I wanted to share my experience with others to give my perspective on how I completed the basics.

In fact to fully understand everything in regards to the Python Basics I have had to watch the whole course twice. However, the second time round was not just simply watching the course but it had a purpose instead. I have seen that it does not just take python knowledge to create something but it can be many different things.

Besides the Python Basics Course I have also completed: Bonus series: How to learn, Workshops on how to use Coda, Introduction to the Terminal, Introduction to Git, GitHub Basics, Scrum Basics. And, besides treehouse I have also spent lots of time researching, making notes with Coda, even more time reading concepts, documentation and trying it myself. Thanks to the how to learn bonus content I have implemented the pomodoro technique which has really helped me excel in my learning. I have also just started to read through the Python crash course V2 to work through everything again to reinforce my memory (it is very important to practice what you know so that you don't forget) and, then take up on some fun projects like making a space invaders game.

So if you are learning the basics. Please never give up and keep on going. Eventually you will get there. I always like to compare learning how to code with learning how to skateboard. Practice makes perfect and if you never give up you will eventually reach your goal. Took me months to learn an ollie (jumping on skateboard) but when I finally done it it felt amazing. And you can apply this to anything in life.

This is my slight different version of the code compared to Craig because I did not like how the error was handled with "Would you like to proceed y/n". I have implemented another while loop in there so that if someone makes an error typing it does not kick them all the way back up to the start of the first while loop but instead will give them a friendly error and ask again if they want to proceed. And, I have also added some basic input to ask for credit card information just for fun and practice.

I have also used this project as an opportunity to practice using git and github which I highly recommend to you. If you would like to see how I practiced this is the repository: https://github.com/UP814818/ticket_master

(I recommend doing the introduction to terminal first then, introduction to git course then github basics)


tickets_remaining = 100

def calculate_price(number_of_tickets):
    return (number_of_tickets * TICKET_PRICE) + SERVICE_CHARGE

while tickets_remaining >= 1:
    print("There are {} tickets remaining".format(tickets_remaining))
    user_name = str(input("What is your name? "))
        num_tickets = int(input("{}, how many tickets would you like to purchase? "
        if num_tickets > tickets_remaining:
            raise ValueError("There are only {} tickets remaining"
    except ValueError as err:
        print("Oh no, we ran into an issue. {}. Please Try again"
        total_due = calculate_price(num_tickets)
        print("Total price due is ${}".format(total_due))
        permission = str(input("Would you like to proceed {}? (Y/N): "
        while permission != "y" or "n":
            if permission.lower() == "y":
                #TODO: Error Handling for entering card information.
                credit_card = str(input("{}, Please enter your credit card number: "
                card_exp = str(input("Please enter the card's Expiry Date: "))
                card_cvv = str(input("And, finally enter your CVV: "))
                tickets_remaining -= num_tickets
            elif permission.lower() == "n":
                print("Thank you for your interest {}".format(user_name))
                print("That's incorrect. Please answer with either y or n")
                permission = str(input("Would you like to proceed {}? (Y/N): "
print("Sorry the tickets are all sold out!!! :-(")
Steven Parker
Steven Parker
210,469 Points

I understand that Craig Dennis hasn't been on staff since 2018, but perhaps by tagging him here he may find this posting if he still checks the forum now and then.

Szymon Dabrowski
Szymon Dabrowski
2,161 Points

Steven Parker. I think Craig has noticed as I seen he has given me a star on github :)