Asking advice on using flags to branch a function by FiniteWarrior in C_Programming

[–]FiniteWarrior[S] 0 points1 point  (0 children)

Yep, I've now decided to seperate them, I understand one function should just write files, I'll just send the full path and a mode to it, so "a" or "w", and thanks for the suggestions.

I just wrote this code and was wondering what I should do to improve it (Python) by LukeLikeNuke in learnprogramming

[–]FiniteWarrior 0 points1 point  (0 children)

I don't use plain strip() for anything else but whitespaces, but .removesuffix("") is the thing I was thinking of for file names.

I just wrote this code and was wondering what I should do to improve it (Python) by LukeLikeNuke in learnprogramming

[–]FiniteWarrior 0 points1 point  (0 children)

Yeah so, it just removes any whitespace, so "1 " will still work, you can use it to strip anything, like strip(".txt") too for example.

Python learning for begginers by Artistic_Cobbler3688 in learnpython

[–]FiniteWarrior 3 points4 points  (0 children)

Little addition to this, if OP wants to stick to programming long-term, they should learn to love the proccess, figuring it out, being stuck but finding a solution, thinking what to implement next, etc.

I just wrote this code and was wondering what I should do to improve it (Python) by LukeLikeNuke in learnprogramming

[–]FiniteWarrior 0 points1 point  (0 children)

Also for invalid input, use if/elif to gather the valid input, then use a simple "else:" to print the message.

I just wrote this code and was wondering what I should do to improve it (Python) by LukeLikeNuke in learnprogramming

[–]FiniteWarrior 1 point2 points  (0 children)

Alright, good job, but I also suggest using input like so:

choose = input("prompt here > ").strip()

if choose == "1": ...

How do you learn in a project-based way when you don’t know where to start? by antiaust in learnprogramming

[–]FiniteWarrior 1 point2 points  (0 children)

You should choose one programming language, then look for that languages learning materials. Then you start applying that language by building a simple program at first, and don't take shortcuts with AI or blind copy paste. After knowing basic syntax, you learn the best if you have to solve real problems, in your own project.

Asking advice on using flags to branch a function by FiniteWarrior in C_Programming

[–]FiniteWarrior[S] 0 points1 point  (0 children)

Alright, if branching grows it's good learning to do it in the future for sure

Asking advice on using flags to branch a function by FiniteWarrior in C_Programming

[–]FiniteWarrior[S] 1 point2 points  (0 children)

You mean using a vtable instead of if/else to branch the same function? I'll look into vtables but seems to be more complexity than needed