#๐Ÿ”’ DIGITAL DIARY LOG SYSTEM

77 messages ยท Page 1 of 1 (latest)

green heraldBOT
#

@fickle wraith

Python help channel opened

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.

fickle wraith
#

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

small raven
#
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 :)
```???
fickle wraith
#

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

small raven
#

def start(): a more appropriate name would be main

fickle wraith
#

true, ill change that

small raven
#
        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()
fickle wraith
#

oh shit i didnt know i coulld do that

#

fuck yeah that cleans up a nice chunk of code

small raven
#

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":
    
fickle wraith
#

ah i did that so it was easier fo rme to read. ill fix those now

small raven
#

I mean keeping 1 newline is probably fine but 3 newlines is wild

fickle wraith
#

sorry lol

small raven
#

if its difficult to read for you that way you could move the contents of the if blocks into their own functions

fickle wraith
#

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

small raven
#

I don't see any issues with your use of sqlite other than a nitpick or two

fickle wraith
#

im happy to hear the nitpicks, it might help me learn smth

small raven
#

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
fickle wraith
#

ohh that makes sense. that way im only calling it once ot commit everything in the loop

small raven
#

ya

fickle wraith
#

like this or would i out it at the end after the else?

small raven
#

after everything else

fickle wraith
#

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

small raven
#
        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

fickle wraith
#

sorry my b

small raven
small raven
fickle wraith
small raven
#

yessir

fickle wraith
#

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!

fickle wraith
#

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

small raven
#

ooh stardew

#

i wanted to recreate that once

#

but guess what its not something you can make in a weekend :(

fickle wraith
#

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

small raven
fickle wraith
#

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

small raven
#

its fine if i actually tried I would've used raw C and lost motivation instantly lol

fickle wraith
#

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

small raven
#

maybe maybe
kinda preoccupied with a ton of stuff rn, maybe in a year or so i'll give it a go

fickle wraith
#

yeah ! if you do id love to see it.

#

if u dont tho i will look at you knowingly and nod i get you

small raven
#

lmao

green heraldBOT
#
Python help channel closed

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.