Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions simulation-with-simpy/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Simulating Real-World Processes With SimPy

Corresponding code for ["Simulating Real-World Processes With SimPy."](https://realpython.com/simulation-with-simpy/)
Corresponding code for ["SimPy: Simulating Real-World Processes With Python."](https://realpython.com/simpy-simulating-with-python/)

## Requirements

The script runs on Python 3.8 or later. Install SimPy from `requirements.txt`:

```console
$ python -m pip install -r requirements.txt
```

## Running the Script

Expand All @@ -14,5 +22,5 @@ Input # of cashiers working: 1
Input # of servers working: 1
Input # of ushers working: 1
Running simulation...
The average wait time is 42 minutes and 26 seconds.
The average wait time is 42 minutes and 53 seconds.
```
1 change: 1 addition & 0 deletions simulation-with-simpy/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
simpy==4.1.2
10 changes: 5 additions & 5 deletions simulation-with-simpy/simulate.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Companion code to https://realpython.com/simulation-with-simpy/
"""Companion code to https://realpython.com/simpy-simulating-with-python/

'Simulating Real-World Processes With SimPy'
'SimPy: Simulating Real-World Processes With Python'

Python version: 3.7.3
SimPy version: 3.0.11
Python version: 3.15
SimPy version: 4.1.2
"""

import random
Expand Down Expand Up @@ -82,7 +82,7 @@ def get_user_input():
params = [int(x) for x in params]
else:
print(
"Could not parse input. Simulation will use default values:",
"Could not parse input. The simulation will use default values:",
"\n1 cashier, 1 server, 1 usher.",
)
params = [1, 1, 1]
Expand Down
Loading