353
submitted 5 months ago by petsoi@discuss.tchncs.de to c/linux@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] tuhriel@discuss.tchncs.de 10 points 5 months ago
print("Hello World")

Save the file as script.py

And then execute it with

python3 script.py

[-] EuroNutellaMan@lemmy.world 6 points 5 months ago

Impressive, you look like a very skilled programmer, management has told me you are now tasked with building a hyper-realistic virtual simulation of a Large Hadron Collider including detailed simulations of the lives of the actual workers and their families, you have a week or you're fired by the firing squad, no you're not allowed to ask why we need it or who we are or why we chose you and it is especially forbidden to ask for more time (and no you can't ask why that is either). See you in a week, have a nice day :).

[-] JackbyDev@programming.dev 2 points 5 months ago

I am ready to ~~integrate with Open AI's API~~ develop an LLM.

[-] JasonDJ@lemmy.zip 1 points 5 months ago* (last edited 5 months ago)

This is bad practice.

More accurately it should look something like this:

# Load sys library for exiting with status code
import sys

def sayHelloWorld(outPhrase: str="Hello World"):
    # Main function, print a phrase and return NoneType
    print(outPhrase)
    return None

if __name__=="__main__":
    # Provide output and exit cleanly when run from shell
    sayHelloWorld()
    sys.exit(0)
else:
    # Exit with rc!=0 when not run from shell
    sys.exit(1)
[-] calcopiritus@lemmy.world 1 points 5 months ago

Fellow pythonistas, how can I make this code more pythonic?

this post was submitted on 20 Jun 2024
353 points (100.0% liked)

Linux

48340 readers
412 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS