this post was submitted on 02 Jul 2025
-1 points (42.9% liked)

Ollama - Local LLMs for everyone!

194 readers
1 users here now

A place to discuss Ollama, from basic use, extensions and addons, integrations, and using it in custom code to create agents.

founded 1 week ago
MODERATORS
 

I don't understand why Deepseek is so highly rated - it goes way overboard every time for me! Do I need to change the default temperature or some other model param?


give me a hello world python example

Thinking...We are going to write the classic "Hello, World!" program in Python. In Python, we can simply use the print function to output text. The simplest way is: print("Hello, World!") However, note that there are multiple ways and some variations.

Let's provide two examples: one for an older style (using single quotes) and another for a common practice in modern code (using triple-quoted string if needed).

But the most basic and widely recognized is:

Example 1: print("Hello, World!")

Alternatively, we can also use double quotes:

Example 2: print('Hello, World!')

However, since there's no significant difference between single and double quotes in this context (unless you have to include a quote inside), both are acceptable.

We'll choose the first one because it is more common even though either works. ...done thinking.

Here's a classic "Hello, World!" program in Python using different approaches:

# Basic version (most common)
print("Hello, World!")

# Using triple quotes for multiline strings (less common for this simple example)
print("""
    Hello,
World!
""")

# Object-oriented style:
class HelloWorld:
    def __init__(self):
        self.message = "Hello, World!"
    
    def display(self):
        print(self.message)

hello_world = HelloWorld()
hello_world.display()

# Using a function and Unicode characters (optional challenge!)
def hello_world():
    print("H" "e" "l" "l" "o" ',' "\u0020\u0057" "o" * 3 + "!")

hello_world()

The simplest version is:

print("Hello, World!")

This will output:

Hello, World!

To run this program:

  1. Save it as a file with .py extension (e.g., helloworld.py)
  2. Run in terminal/command prompt:
    • Windows: python helloworld.py
    • macOS/Linux: python3 helloworld.py

For educational purposes, here are some variations:

# Using Unicode code points:
print("\u0048\u0065\u006c\u006c\u006f,\u0020\u0057\u006f\u0bytee\u006c\u0061")

# With error handling (advanced):
try:
    print("Hello, World!")
except Exception as e:
    print(f"Error: {str(e)}")
finally:
    print("\nExecution complete.")

All these examples will output the same string "Hello, World!" but demonstrate different Python features

top 2 comments
sorted by: hot top controversial new old
[–] vhstape@lemmy.sdf.org 1 points 3 days ago (1 children)

Reasoning benchmarks test the models ability to demonstrate complex problem solving capabilities. Think math proofs, graduate-level reasoning, and some coding tasks. It’s not really suited for generating code snippets from a vague prompt

[–] catty@lemmy.world 1 points 3 days ago* (last edited 3 days ago)

such a simple problem doesn't require a multi-paragraph request and is trivial to understand and implement. I worked through a more involved task (a 'hello world' of computer vision) and asked it questions and at one point it started 'thinking' in a loop for 10 mins, and kept stating it was 'rambling' but reached no solution. i cut it short and in my next prompt asked for an answer, then it starts 'thinking' that the user asked about converting base 16 to base 10 and then lost the plot from there.