Skip to content

Commit 3d1d5ac

Browse files
style: format code with autopep8
Format code with autopep8 This commit fixes the style issues introduced in 92fdf42 according to the output from Autopep8. Details: https://app.deepsource.com/gh/avinashkranjan/Amazing-Python-Scripts/transform/fc5d00e4-143c-425d-b614-1a1a3ddd14a6/
1 parent 92fdf42 commit 3d1d5ac

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Bus ticket generator/bus_ticket_generator_script.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import time
22

3+
34
def print_delay(text, delay=1):
45
print(text)
56
time.sleep(delay)
67

8+
79
def calculate_fare(service_type, distance):
810
seater_rate_per_km = 0.4 # Modify this value for the seater service fare per kilometer
9-
sleeper_rate_per_km = 0.8 # Modify this value for the sleeper service fare per kilometer
11+
# Modify this value for the sleeper service fare per kilometer
12+
sleeper_rate_per_km = 0.8
1013

1114
if service_type.lower() == "seater":
1215
return seater_rate_per_km * distance
@@ -15,20 +18,21 @@ def calculate_fare(service_type, distance):
1518
else:
1619
return None
1720

21+
1822
def generate_bus_ticket():
1923
print("Welcome to the Bus Ticket Generator!")
2024
print("Please enter the following details to generate your bus ticket.")
21-
25+
2226
passenger_name = input("Passenger Name: ")
2327
destination = input("Destination: ")
2428
date_of_travel = input("Date of Travel: ")
2529
seat_number = input("Seat Number: ")
26-
30+
2731
print("Select the type of ticket:")
2832
print("1. One-way")
2933
print("2. Round trip")
3034
ticket_type = input("Enter the option number (1 or 2): ")
31-
35+
3236
if ticket_type == "1":
3337
ticket_type = "One-way"
3438
distance = float(input("Enter the distance (in kilometers): "))
@@ -59,5 +63,6 @@ def generate_bus_ticket():
5963
print("Invalid option. Please enter '1' or '2' for ticket type.")
6064
return
6165

66+
6267
if __name__ == "__main__":
6368
generate_bus_ticket()

0 commit comments

Comments
 (0)