Python Assignment

See screenshots at the bottom of the page

Order Description

3 Pre-workshop questions (1 mark)Complete these questions in writing before the start of the workshop. They will be marked early in theworkshop.1. Which Python type would be appropriate for:(a) the number of cars in a company fleet?(b) the registration number (e.g. 111AAA) of a particular car?(c) does a particular car have an automatic transmission?(d) a car’s year of manufacture?1(e) a car’s engine displacement in litres?(f) was a car manufactured in the last 3 years?2. What are the names of these characters?(a) ,(b) ;(c) :(d) ((e) g3. Complete this table, if the following statements have already been executed.i = 7j = 2x = 2.2

expression type value i int 7 i < 10 i < j i % 2 j % 2 i % 2 == 0 j % 2 == 0 i % 2 == j % 2 ’x * x’ x * x < 2 * x i % 2 == 0 or j % 2 == 0 i % 2 == 0 and j % 2 == 0

4 Workshop activities4.1 Marking last workshop’s problemsIf you have problems that still need marking from the previous workshop, get them marked at the startof this one.4.2 Problem 1 (1 mark)Problem: Write a program that reads whole numbers typed by the user until a negative numberis entered, then prints the number of even numbers that were entered. Sample run:2$ python3 CountEvens.pyEnter a number: 3Enter a number: 4Enter a number: 7Enter a number: 2Enter a number: 2Enter a number: 9Enter a number: -13 even numbers were entered.$Hint: Use the sentinel pattern.4.3 Problem 2 (1 mark)Problem: A small concert theatre for chamber music has seating for 100 guests. Write aprogram that the box office can use to make sure only 100 seats are sold. It should look likethis when run.Seats remaining: 100. How many in your group? 40Booked, thank you.Seats remaining: 60. How many in your group? 39Booked, thank you.Seats remaining: 21.How many in your group? 20Booked, thank you.Seats remaining: 1. How many in your group? 5Sorry, not enough seats left.Seats remaining: 1. How many in your group? 1Booked, thank you.SOLD OUT!4.4 Problem 3 (1 mark)Problem: Write a program that prints a grid of alternating characters, as in these examples:$ python3 XO.pyHow many rows: 3How many columns: 4XOXOOXOXXOXO$ python3 XO.pyHow many rows: 3How many columns: 5XOXOXOXOXOXOXOX$4.5 Problem 4 (1 mark)This problem might be a little harder. Hint: do you need a loop?Problem: A rugby team has 15 players. A bus company has big buses that can carry 48passengers and small buses that can carry 10 passengers. Big buses cost $200.00 to hire.Small buses cost $95.00 to hire. Write a program that the tournament organiser can useto calculate the number of big and small that should be hired to minimise the total cost.Examples:3How many teams? 1Hire 0 big buses and 2 small buses.Cost = $190.0How many teams? 2Hire 1 big buses and 0 small buses.Cost = $200.0How many teams? 3Hire 1 big buses and 0 small buses.Cost = $200.0How many teams? 4Hire 1 big buses and 2 small buses.Cost = $390.0How many teams? 10Hire 3 big buses and 1 small buses.Cost = $695.05 After the workshop• You have created programs that might be useful to refer back to in future workshops. Make surethat you will have that work in the future. One copy is not enough for at IT professional. Youshould have at least 2 copies:1. on your Griffith network storage drive; and2. on your portable storage device

Screenshots