Org Babel

https://systemcrafters.net/emacs-from-scratch/configure-everything-with-org-babel/

x = 10
y = 20
print(f"The sum of {x} and {y} is {x+y}")
103 20 30
print(f"Values: {data}")
for value in data[0]:  # data is passed as a list of lists
    print(f"Value: {value}")

Product Price Quantity
A 10 5
B 15 3
C 20 2
Dffffffffff 5 8
# Calculate subtotal for each row and sum
subtotals = []
total = 0

for row in data[0:]:
    price = float(row[1])
    quantity = int(row[2])
    subtotal = price * quantity
    subtotals.append(subtotal)
    total += subtotal

# Return both individual subtotals and the total
result = "| Product | Price | Quantity | Subtotal |\n"
result += "|---------+-------+----------+----------|\n"

for i, row in enumerate(data[0:]):
    result += f"| {row[0]} | {row[1]} | {row[2]} | {subtotals[i]} |\n"

result += f"|---------+-------+----------+----------|\n"
result += f"| Total | | | {total} |"

return result

org-structure template < + tab complete

(message (concat "Hello " "World" " !"))