Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Search results

  1. skifli

    Python Feedback on snake game.

    Hey, For fun I challenged myself to make a snake game in Python entirely in the console without any external libraries (apart from `colorama` and `pynput`). I was wondering if anyone might have any feedback on the game's code, specifically in ways to simplify the code. The code isn't that well...
  2. skifli

    Feedback New forum colors

    Just being a bit pedantic here, but on the theme chooser, dark is spelt in all capitals whereas light is not.
  3. skifli

    Thanks. How have things been in my absence?

    Thanks. How have things been in my absence?
  4. skifli

    Fun activity Say hello... in a coding language!

    I love one-liners... and yes it does work. lst = lambda *args: [ arg if type(args[index]) == type(arg) else type(args[index])(arg) for index, arg in enumerate([ chr(0).join([arg[int(chr(48))] for arg in [[str(arg)] for arg in args]]) ][int(chr(48))].split(chr(0))) ]...
  5. skifli

    I'm back!

    I'm back!
  6. skifli

    Python How to kill a thread?

    @Sigma Example using a global variable to tell the thread to stop. Please note that there will be a time after 'thread_stop' is set to 'True' while the thread is still running as we have to wait for the thread to get to the code which checks the variable's value. from threading import Thread...
  7. skifli

    Python How to kill a thread?

    Threads are non-killable (or at least Python doesn't have a thread kill implementation by default). You could use global variables or variables in a specific file and have the thread periodically check the value of that variable. Or you can use processes if you don't mind separate processes, and...
  8. skifli

    Python What is this feature called and what other languages have it?

    TL;DR: `exec` is a function in interpreted programming languages that execute the code passed to them. They are not found in compiled programming languages because the code has already been compiled to machine code. `exec` is a function in Python used for dynamic execution of Python code. It...
  9. skifli

    C Feedback on hash table implementation.

    Ah sorry, I didn't realize that, since I added those keys especially for the posting the code here.
  10. skifli

    C Feedback on hash table implementation.

    As C programmers will know, C doesn't have a implementation for dictionaries, and so you have to implement your own using hash maps. I am new to C, and created a hash map implementation, and would be grateful for any feedback. The program also uses a custom list implementation to allow easy...
  11. skifli

    Python Military Time Converter Assignment

    @menator01 Yep, they don't work.
  12. skifli

    Python Military Time Converter Assignment

    I'm not sure if those will work on Windows, here's a file of all the ANSI Escape Sequences I have that are cross platform. Please note that the old windows terminal doesn't support these (the new one does though). https://github.com/splewdge/Python-ANSI-Escape-Sequences...
  13. skifli

    Python Military Time Converter Assignment

    This should work: military_time = input("Enter the military time: ") military_hour, minute = military_time[:2], military_time[2:] if military_hour == "00": hour = "12" state = "AM" elif int(military_hour) > 12: hour = int(military_hour) - 12 state = "PM" else: hour = military_hour...
  14. skifli

    Python Removing a character from a string using user input

    Why are you using an if statement to check if the char is in the string? Even if the char isn't in the string `.replace` won't raise an error.
  15. skifli

    PDF to Images

    Try: python -m ensurepip Then, install each of the modules by doing the following: python -m pip install [package]
  16. skifli

    Creepy Hugs

    Hmmmmmm...
  17. skifli

    PHP Why does ../ work but not / for relative file paths?

    We are not talking about the difference between how OSes handle `/`, we are talking about the difference in how HTML and PHP handle the `/` character. HTML handles it as go to the root of the directory being served. PHP handles it as go to the root of the drive.
  18. skifli

    PDF to Images

    @Johna Did you have the `Install Pip` option selected when installing Python?
  19. skifli

    Python Floating point numbers subtracting incorrectly

    Rounding by the highest amount of decimals out of the two numbers should work @Johna.
  20. skifli

    Python Floating point numbers subtracting incorrectly

    If you want the exact output, 2 - 1.23456789
Back
Top Bottom