#๐ DIGITAL DIARY LOG SYSTEM
77 messages ยท Page 1 of 1 (latest)
@fickle wraith
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
cool my original message was deletec.
what can i do better to make my code cleaaner? is there anything i can change to make the code more ergonomic?
awesome i cant upload the file either.
PASTEBIN gimmie a sec
if False:
cur.execute("CREATE TABLE entry(day, words)")
``` you can change this to ```py
cur.execute("CREATE TABLE IF NOT EXISTS entry(day, words)")
res.fetchone() is None
if True:
print(f"this code didnt find it, its working") #this is me checking that it queries correctly for the tables :)
```???
DIGITAL DIARY LOG SYSTEM. General readability and advice
oh i forgot to delete that one lol
that was making ssure that it was fetching properly
basically bc github scares me it was a check that the code was working up to that point when i ran it. that way i could check for errors along the way in smaller chunks rather than doing buncha code and then trying to figure out what teh issue was with the whole code and freaking out
def start(): a more appropriate name would be main
true, ill change that
menu = input("What can I help you with today?\n")
menu_2 = menu.lower()
``` kinda weird to make a new variable here, just do ```py
menu = input("What can I help you with today?\n").lower()
oh shit i didnt know i coulld do that
fuck yeah that cleans up a nice chunk of code
Also, remove all the newlines between the end of a if block and the next elif block
ie ```diff
con.commit()
-
elif menu_2 == "view logs":
ah i did that so it was easier fo rme to read. ill fix those now
I mean keeping 1 newline is probably fine but 3 newlines is wild
sorry lol
if its difficult to read for you that way you could move the contents of the if blocks into their own functions
true. i also just have a habit of hitting enter a couple times so i gotta break that
other than those do you think its okay for a first go at sqlite?
technically a second i could pase the 1.0 version of this its like a third of the size and doesnt do everything i want it to
yes
I don't see any issues with your use of sqlite other than a nitpick or two
sure sure
after every action that edits the database you're calling a con.commit(), which you can move to the last line of your while loop
while True:
... # all your code
con.commit() # commit after all your actions are done
ohh that makes sense. that way im only calling it once ot commit everything in the loop
ya
like this or would i out it at the end after the else?
after everything else
so like alll the way down just above the menu and exit?
oh i see bc if the return is done and ive done something else its already looped through and done the commit
else:
print(f"Unknown query. Did you spell everything correctly?")
con.commit()
oh wtf
man i hate tabs
pls dont use tabs
use 4 spaces for indentation
sorry my b
the con.commit() is supposed to be at the same indentation as else
u can configure ur sublime text to place 4 spaces instead of a tab character when you press tab btw
yessir
oh fuvk yeah
i wanna see if i can fiddle around and get it to run my sublime repl run script when i hit ctrl + b
i think thats smth i can do
i feel on top of the world
MY CODE IS PASSABLE!
ive never used sublime so idk
i know theres a buncha funky stuff with the prefrences. its just gives you the like
c# file or whatever
ive done a biiiiiiiit of c# and java when i made a game demo and modded starydew so i kiiiiiiiinda know what im doing. ill run thru it and see
ooh stardew
i wanted to recreate that once
but guess what its not something you can make in a weekend :(
the files are pretty easy to parse through for me (a beginner) so it shouldnt be tooooo daunting. tedious but
oh yeah its not i never finished my mod
helped me learn c# tho and the sdv discord has a modding and coding section. theyre all very very nice people helped me out a lot
no i mean recreating stardew as a whole not a mod
yeah thats what i mean. im saying i never finished my mod and i worked on that for weeks. it was a pretty small scale mod too. remaking the whole game would take a lot of time. and if you have more of an iunderstanding of coding than i do, looking through files for refrence if you cant fifure how smth was done shouldnt be hard
its fine if i actually tried I would've used raw C and lost motivation instantly lol
LMAO
you could do just like a chunk of it? recreate the shop system or like the farming system.
still a lot of work but not as daunting as the whole game
and you dont feel like you hav to commit once youve started ig
maybe maybe
kinda preoccupied with a ton of stuff rn, maybe in a year or so i'll give it a go
yeah ! if you do id love to see it.
if u dont tho i will look at you knowingly and nod i get you
lmao
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.