HNHacker News
TopNewBestAskShowJobs

kaunta

142 karma · joined August 21, 2018

submissionscomments
kaunta··on Show HN: RomM – An open-source, self-hosted ROM manager and player
This idea was explored by Joël Franušić and Adam Smith:

"Playable Quotes for Game Boy Games" - https://www.youtube.com/watch?v=z9JYOZWLMlo

kaunta··on Using Python's Bisect Module
The C version is in Modules/_bisectmodule.c, whereas the Python version is in Lib/bisect.py.

Python version: https://github.com/python/cpython/blob/master/Lib/bisect.py

C version: https://github.com/python/cpython/blob/master/Modules/_bisec...

kaunta··on Using Python's Bisect Module
I should just write O(n).

Thanks for catching the mistake, @dmurray. I'll fix that.

kaunta··on Building a command line tool to simulate the spread of an infection
Garrett, thank you.

* * *

My inspiration for writing this came from watching 3Blue1Brown's YouTube video, "Simulating an epidemic":

https://www.youtube.com/watch?v=gxAaO2rsdIs

His simulations cover several scenarios:

- Simulating social distancing.

- Having people travel to a central location (e.g. a grocery store).

- What if the government is able to identify and isolate cases?

- Simulating multiple communities with travel, that put quarantine measures in place.

- What happens when people get tired of social distancing.

* * *

Thanks for sharing your code.

I see that you are using gnuplot to visualize the output of the script. Have you considered using the csv module (https://docs.python.org/3/library/csv.html) to output the data, instead of using the print() function? That way, you wouldn't have to manually add in spaces around the data and stringify the numeric data.

  >>> import csv, sys
  >>> writer = csv.writer(sys.stdout, delimiter=" ")
  >>> writer.writerow(["#", "T", "S", "I", "R"])
  # T S I R
In the script, usage would look something like this:

  import csv
  import sys
  
  ...
  
  writer = csv.writer(sys.stdout, delimiter=" ")
  
  writer.writerow(["#", "T", "S", "I", "R"])
  writer.writerow([T, S, I, R])
  while I > 1000:
  
      ...
  
      writer.writerow([T, S, I, R])
kaunta··on Ask HN: How to self-learn Python?
Python.org has an official tutorial on their website:

https://docs.python.org/3/tutorial/