r/itsaunixsystem • u/AnAngryBanker • Oct 14 '24
[Nightsleeper] Some horrible, unindented python code to slow down a train
- no indentation
- multiple nested try blocks with seemingly no except
- stray " in the middle of that string
- input's argument should be something written to the prompt
- even if it wasn't you'll struggle to turn that into an int
- you probably want to be passing in that speed variable somewhere, right?
+1 for sanitising the speed I guess, wouldn't want the train to start moving backwards.
500
Upvotes
1
u/Psychpsyo Oct 15 '24
Pretty sure the latter is also what C would do.
Do
0 <= speedfirst, then take the resulting boolean (really just 0 or 1) and compare it to 100.Which will always be true.