JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Gallery
Cinema World Update with starter code
Share
Explore
Gallery
Cinema World Update with starter code
Cinema World Update with starter code
The Task
Python Starter Code
Code Clips
Python Starter Code
Copy and paste the code below into your
main.py
file before you begin the task.
# Cinema World Update
# -------------------
# initialise variables
ticketCost
=
5
;
drinkCost
=
2
;
# ---- Input ----
# print blank line
print
(
'\n'
)
# ask user for full name and store answer
fullName
=
input
(
'Enter name: '
)
# ask user for name of filme and store answer
filmName
=
input
(
'Enter film name: '
)
# ask user for number of tickets and store answer
numberOfTickets
=
int
(
input
(
'Enter number of tickets: '
)
)
# ask user for number of drinks and store answer
numDrink
=
int
(
input
(
'Enter number of drinks: '
)
)
# ---- Process ----
# calculate the total cost of tickets
totalTickets
=
numberOfTickets
*
ticketCost
;
# calculate the total cost of drinks
totalDrinks
=
drinkCost
*
numDrink
;
# calculate that total overall cost including tickets, popcorn and drinks
totalCost
=
totalTickets
+
totalDrinks
;
# ---- Output ----
# display ticket confirmation
# print blank line
print
(
'\n\n'
)
print
(
'CINEMA WORLD'
)
print
(
'------------'
)
print
(
'\n'
)
print
(
'Ticket confirmation'
)
print
(
'\n'
)
# display full name
print
(
'Customer name: '
+
fullName
)
# display film
print
(
'Film title: '
+
filmName
)
# display number of tickets
print
(
'Tickets ordered: '
+
str
(
numberOfTickets
)
)
# display number of tickets
print
(
'Drinks ordered: '
+
str
(
numDrink
)
)
# display total cost
print
(
'Amount to pay: £'
+
str
(
totalCost
)
)
Gallery
Share
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
Ctrl
P
) instead.