Python Python Basics All Together Now Gather Information

Type python.masterticket.py into console, press enter, and it says "command not found?"

This might be a dumb question, but I type this code in, named the file python.masterticket.py just like the video, typed it into the console, and it says command not recognized?

Code -

TICKET_PRICE = 10

tickets_remaining = 100

Output how many tickets are remaining using the tickets_remaining variable

print("There are {} tickets remaining.format(tickets_remaining))

Gather the user's name and assign it to new variable

name = input("What is your name? ")

Prompt the user by name and ask how many tickets they would like.

num_tickets = input("How many tickets would you like {}? ".format(name)) num_tickets = int(num_tickets)

Calculate the price of the tickets (Number of tickets x price per ticket) and shown the cost

amount_due = num_tickets * TICKET_PRICE

Output the cost on screen.

print("The total cost is {}".format(amount_due))

Console -

treehouse:~/workspace$ python.masterticket.py

Press "Enter/Return And this returns: **

bash: python.masterticket.py: command not found
treehouse:~/workspace$

2 Answers

Grigorij Schleifer
Grigorij Schleifer
10,352 Points

Hi Avi, you should type

# no dot between python and masterticket
python masterticket.py

instead of

python.masterticket.py
Podrig Leoghain
Podrig Leoghain
5,089 Points

Avi you should really mark an answer as correct. Did Grigorij's answer work? (Spoiler: it should do!)

Oh sorry! How do I do that? I marked his as the best answer, but didn't see an option for correct. (New here)

Podrig Leoghain
Podrig Leoghain
5,089 Points

My mistake, 'best answer' is correct (pun intended).

aditya verma
aditya verma
1,069 Points

i just used the File->Open option; as typing python masterticket.py wasnt doing anything.