Can someone please convert this python code to psuedocode?? Ticket reservation (
ID: 3916747 • Letter: C
Question
Can someone please convert this python code to psuedocode??
Ticket reservation (FALTU-PROGRAM) with open ("transactions.csv", "r") as input file: lines input file.read) split(' ') whilein lines: lines.remove (') availablestart-int (lines.pop (0)) Cancellations- Reservations0 for line in lines: if int (line) 0: Reservations +int (line) else: Cancellations +-int (line) availableEnd availableStart - Reservations - Cancellations with open ("output.csv,w) as out: dataI,, ,.format (availablestart, Reservations, Cancellations, availableEnd) out.write (data)Explanation / Answer
Psudeocode for Ticket reservation:
1. open the filename called transaction.csv in read mode.
-->while reading the file store each line in a variable called lines.
--->If you find ' ' in lines please remove
2. Initialize the following variables.
i)availableStart = top line of the statements in each row and at the same time removing from the file
ii)Cancellation with zero count
iii)Reservations with zerocount initially.
3)Now,we have to know the reservations in each row by running the for loop
for each line in lines : means for each row in excel sheet
if you find rowNumber(reservations) greater than zero:
then increase the reservation count
else :
then increse the cancellation count
4)Now, after the for loop calculate the avaiableEnd using the following formula.
availableEnd = availableStart - ReservationsCount - CancellationsCount
here availableEnd variable indicates how seats are left after reservation and cancellation from the seats that are available in the begining.
5)Now,we have to write this data into a new csv file called "output.csv" in write mode
fomrat is { availableStart,ReservationsCount,CancellationsCount,availableEnd }
close the file after the task is done.