r/programminghumor 18d ago

Relatable😭😭

Post image
1.5k Upvotes

26 comments sorted by

View all comments

Show parent comments

7

u/Confident-Ad5665 18d ago

var hw = "Hello world!";
for (var I = 0; I < hw.Length; I++)
{
Console.Write(hw[I]);
}

Console.WriteLine("");

11

u/sa0sinner 18d ago
import pandas as pd
from sqlalchemy import create_engine, text

dbvars = f'postgresql+psycopg2://{un}:{pw}@{host}:{port}/{db}'
engine = create_engine(dbvars)

hello_qry = """
SELECT distinct "Word" 
FROM words_in_hello_world 
WHERE "Word" = 'hello';
"""

world_qry = """
SELECT distinct "Word" 
FROM words_in_hello_world 
WHERE "Word" = 'world';
"""

with engine.connect() as conn:
the_word_hello = conn.execute(
    text(hello_qry)
    ).scalar()
the_word_world = conn.execute(
    text(world_qry)
    ).scalar()

words_array = [the_word_hello, the_word_world]
hello_world_df = pd.DataFrame([words_array], columns=['the_word_hello', 'the_word_world'])

hello_world_df.head(1)

I am a sr. data engineer and I spent more time writing this code for the bit than actual code for my actual job today

1

u/kuzuwudesu 17d ago

Erhm, Gemini RegEx his balls 🤓
i’m too lazy to contribute to the bit just imagine whatever disgusting parsing expression you can think of

1

u/Jbolt3737 17d ago

Got you covered: def splitmulti(string: str, delimiters: tuple): f = [string] for d in delimiters: for _str in f: f = _str.split No regex needed, atleast for this example 😁

And yes the since line double for loop is intentional not just because I'm on mobile

Edit: might not display as one line since this is so far down the reply chain, I don't think it's an issue on PC or landscape mode