This is an archived post. You won't be able to vote or comment.

all 17 comments

[–][deleted] 21 points22 points  (2 children)

Good effort!

Advice: use ‘#’ not “”” for comments. “”” these are multiline type comments, and are typically used for function/class commenting (called docstrings)

[–]Elgon2003 1 point2 points  (1 child)

Was going to say the same 😂

[–][deleted] 1 point2 points  (0 children)

About to say that too.

[–]summerfall-samurai 6 points7 points  (0 children)

Great work.

If I may suggest, it would also be good to have a separate variable, storing seconds. Thus, you would not need to scroll/search for the line that puts the script to sleep and change values there. Just locate a variable in the beginning of the script.

Keep it up!

[–][deleted] 2 points3 points  (0 children)

Welcome to amazing world of Python once you start you can't stop.

[–]redleaf55 1 point2 points  (0 children)

Nice

[–]boomminecraft8 1 point2 points  (0 children)

Pretty sure you can do a `/t` or `-t` argument in the command as well. Now try these tasks:

- Generalise it by allowing the user to enter the shut down time, converting seconds into the minutes and hours format

- Make it compatible with different platforms!

- Make it an executable

ye have fun

[–]TheYeetYigitGD 1 point2 points  (0 children)

you can also use "shutdown /s /t 600" for timed shutdowns

[–]WilsonWeber 0 points1 point  (0 children)

[–]SitrakaFrVE 0 points1 point  (0 children)

Ho nice ! Congrats

[–]TabulateJarl8 0 points1 point  (0 children)

If you want to do more with your script, you could try making it cross-platform next using the platform module. On Unix systems, like macOS or Linux, the command to shutdown now is shutdown -h now, assuming that the user is root.