Click here to Skip to main content
15,896,201 members

I want some help with a code I wrote in Python ? is my code good or not ?

TheVoidDz asked:

Open original thread
Hello,
Recently i have been working on a simple Simulation Code (Discrete Event Simulation) with a single queue and single server and deterministic number of clients with Python , i just want to know if my code is correct or i'm i missing something , because i'm having some difficulites in the Queue , how to fill it if the new Arrivals of a clients are < to the Departure Time of a previous Client .. my code work but its just fill one client at a time then pop it from the queue to start the service .. etc
what i'm i missing here ?

What I have tried:

I have Tried this code here : [Python] Simulation Queue Python - Pastebin.com[^] i wrote it using class , and i still didn't try Simpy Framework .


i'm supposed to have the algorithm like this .. the first client arrive , the server start the service directly and then after it finish the client leave , while the server is busy , there is a possibility that another client has come , so the server can't treat the 2nd client , and the 2nd will enter the Queue , waiting for the 1st client to finish .. and so on , which means if the third client come he also enter the Queue , My Code he is only queuing one client at a time , i mean the Queue never fills up with the clients waiting , it fill only one client , then pop it when server finish , then queuing the 3rd client .. and so on .. you got my point here ?
Tags: Python, Simulate, Jetbrains, Coding challenge

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900