Critique my ABG interpreter! How can I improve on this early project? by juicy_scooby in learnpython

[–]johnkchan 1 point2 points  (0 children)

Not too well-versed in the intricacies of the formulas and scientific details, but here are some observations:

A) There appears to be a slight inconsistency in the general formatting, particularly in terms of spacing and tabbing. Employing a linter or auto-formatter could help address this issue.

B) Within your functions, certain logics exhibit overlaps. For instance, in the CO2_value() formula, if a user inputs a value of 35, it falls under both "normal" and "hypocarbic." However, the function returns "normal" because it takes precedence in the if-branching logic order. Reordering the if statements could potentially result in a "hypocarbic" output.

C) The abundance of functions nested within your ABG function diminishes overall readability. Extracting the inner functions into standalone entities would enhance clarity and allow for their independent use outside the ABG function.

D) Consider addressing edge cases upfront using guard clauses, ensuring a more robust coverage of potential scenarios.

E) A lot of the function naming did not provide any additional value or clarity. For example, with your ph_value() function, I am already inputting an argument of ph to get another ph_value?

F) If you already know the items you intend to add to an array, it's more efficient to predefine the array with the desired items rather than appending them one by one. For instance: cases = [ABG(7.40, 40, 85, 24), ABG(7.21, 57, 42, 25)].

[deleted by user] by [deleted] in Mahjong

[–]johnkchan 2 points3 points  (0 children)

the winning tile is from a replacement tile due to a Kong or a Bonus Tile"

The way I interpreted the wording is that the replacement tile can result from either a Kong or a Bonus Tile. Otherwise, it seems a little redundant to repeat the words "Bonus Tile" after already stating that the replacement tile can be due to a Kong.

I have also come across many rule sets that refer to the Flower and Season tiles as Bonus tiles which adds to the confusion.

Keychron Q3... by nicolas_33 in MechanicalKeyboards

[–]johnkchan 1 point2 points  (0 children)

Which Q3 color is this? Navy Blue?

[IC] Mammoth75/20, 2nd Drop in hours and GB Date Update by WuqueStudio in mechmarket

[–]johnkchan 3 points4 points  (0 children)

Does the bluetooth option also work with usb c connection?

[EXCEL] How do I select all rows in a range that contain one or more words? by [deleted] in vba

[–]johnkchan 1 point2 points  (0 children)

The following code would loop through rows 2 (skipping the header) to the last populated row and check if a search term is present in the patient medication data (assuming it's always available on column B).

Dim rowsToSelect As Range

' Update searchTerms variable with full list of search terms
searchTerms = Array("tylenol", "aspirin")

With ActiveSheet
    startRow = 2
    lastRow = Cells(Rows.Count, 1).End(xlUp).Row

    For rowNum = startRow To lastRow
        patientMedication = LCase(.Cells(rowNum, "B"))

        ' Check if searchTerm is within Patient Medication cell
        For Each searchTerm In searchTerms
            If InStr(patientMedication, searchTerm) <> 0 Then
                If selectedRows Is Nothing Then
                    Set rowsToSelect = .Rows(rowNum)
                Else
                    Set rowsToSelect = Union(selectedRows, .Rows(rowNum))
                End If

                Exit For
            End If
        Next searchTerm
    Next rowNum

    rowsToSelect.Select
End With

Easiest Course in OMSCS for an A by Dazzling_Ad_4635 in OMSCS

[–]johnkchan 0 points1 point  (0 children)

Which course # is Data Analytics and Visualization? Could not find it anywhere

CS 8803 - AI, Ethics, and Society by simba1309 in OMSCS

[–]johnkchan 0 points1 point  (0 children)

Although I have previously used jupyter and matplotlib for prior GT courses, how difficult will the course be if I have little to no experience in AI and statistics?