-
Notifications
You must be signed in to change notification settings - Fork 15
Cebolwethu Mzanywa #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||||||||||||||||||||||||||||||||||
| import re | ||||||||||||||||||||||||||||||||||||||
| # ========================================== | ||||||||||||||||||||||||||||||||||||||
| # SECTION A: DATA PARSING (FLIGHT TICKET SYSTEM) | ||||||||||||||||||||||||||||||||||||||
| # ========================================== | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -18,7 +19,11 @@ def get_departure_airport(ticket_string: str): | |||||||||||||||||||||||||||||||||||||
| Flight Number (JO234) can vary in length. You must find it relative to the hyphens. | ||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||
| # TODO: Write your code here | ||||||||||||||||||||||||||||||||||||||
| pass | ||||||||||||||||||||||||||||||||||||||
| #my_string = ticket_string[-10:-12] | ||||||||||||||||||||||||||||||||||||||
| my_list = [] | ||||||||||||||||||||||||||||||||||||||
| for i in ticket_string: | ||||||||||||||||||||||||||||||||||||||
| if | ||||||||||||||||||||||||||||||||||||||
| return | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+22
to
+26
|
||||||||||||||||||||||||||||||||||||||
| #my_string = ticket_string[-10:-12] | |
| my_list = [] | |
| for i in ticket_string: | |
| if | |
| return | |
| # The departure airport code is between the second and third hyphens. | |
| parts = ticket_string.split('-') | |
| if len(parts) >= 4: | |
| return parts[2] | |
| return None |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Unnecessary f-string usage. The return statements in this function use f-strings without any variable interpolation. Consider using regular strings instead: return "Economy - 20kg" instead of return f"Economy - 20kg".
| return f"Economy - 20kg" | |
| elif ticket_string[0:2] == "BS": | |
| return f"Business - 40kg" | |
| elif ticket_string[0:2] == "FL": | |
| return f"First Class - 60kg" | |
| else: | |
| return f"Standard - 0kg" | |
| return "Economy - 20kg" | |
| elif ticket_string[0:2] == "BS": | |
| return "Business - 40kg" | |
| elif ticket_string[0:2] == "FL": | |
| return "First Class - 60kg" | |
| else: | |
| return "Standard - 0kg" |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incomplete function implementation. The validate_flight_number function has no return statement and will return None instead of the expected validation result. The function needs to implement the logic to extract the flight number, check if the numeric part is even or odd, and return the appropriate result.
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra leading space in the return string. The return value " WARNING" has an extra space at the beginning, which should be "WARNING" to be consistent with other return values and to match the test expectations.
| return f" WARNING" | |
| return f"WARNING" |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Unnecessary f-string usage. The return statements in this function use f-strings without any variable interpolation. Consider using regular strings instead for better readability and performance.
| return f"Sensor Error" | |
| elif temp > 2000 or radiation > 500: | |
| return f"CRITICAL" | |
| elif (1000 <= temp <= 2000) and radiation > 100: | |
| return f" WARNING" | |
| elif temp < 500: | |
| return f"Maintenance Mode" | |
| else: | |
| return f"Normal Operation" | |
| return "Sensor Error" | |
| elif temp > 2000 or radiation > 500: | |
| return "CRITICAL" | |
| elif (1000 <= temp <= 2000) and radiation > 100: | |
| return " WARNING" | |
| elif temp < 500: | |
| return "Maintenance Mode" | |
| else: | |
| return "Normal Operation" |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,13 @@ | ||||||
| import unittest | ||||||
| from system_check import reactor_status | ||||||
|
|
||||||
| class testReactor(unittest.TestCase): | ||||||
|
||||||
| class testReactor(unittest.TestCase): | |
| class TestReactor(unittest.TestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incomplete if statement with syntax error. The condition after
ifis missing, which will cause a SyntaxError when the code is executed.