#๐Ÿ”’ Please help, problem with assignment.

292 messages ยท Page 1 of 1 (latest)

misty idolBOT
#

@dim wadi

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.

dim wadi
#

hello

gleaming tinsel
#

@dim wadi if your original message contained a file, then upload it with a python's pastebin website

#

!paste

misty idolBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

gleaming tinsel
#

here's the link

dim wadi
#

could you possibly help

gleaming tinsel
#

yeah, sure

#

after the upload u just send the code link here

dim wadi
#

this?

#

how

#

this?

gleaming tinsel
#

mhm

#

that

dim wadi
#

okay

#

i did not learn most stuff..

gleaming tinsel
dim wadi
#

handle_navigator_menu()

#

i havent learnt it]

#

i cant use it..

#

some guy made me this code bc i got midterms

gleaming tinsel
dim wadi
#

no

#

In lecture

#

if i havent learjnt something in lecture i cant use it in a assignment

gleaming tinsel
#

so, can't use match case ?

dim wadi
#

and i have not learnt if name == "main": also

dim wadi
gleaming tinsel
#

match case in that .. case.. is just an exact replacement of a bunch of if elif statements

dim wadi
#

we need to do the bunch of elif statements haha

gleaming tinsel
#

co, case "1" is basically comparing match var like if var == "1"

dim wadi
#

we cant do case and these stuff if havent learnt it

#

we havent learnt var

#

want me to show you how the code should run?

gleaming tinsel
#

var is just any variable name

dim wadi
gleaming tinsel
#
def handle_resolutions():
    choice = print_resolutions_menu()
    match choice:
        case "1": handle_set_resolutions()
        case "2": handle_update_resolutions()
        case "3": handle_delete_resolutions()
        case "4": handle_print_resolutions()
        case "5": print("Returning to New Year Navigator...")
        case _: 
            print("Invalid input! Please choose a valid option (1-5).")
            handle_resolutions()
#

so in this case

dim wadi
#

what even is case

gleaming tinsel
#

match choice means... you're comparing the choice variable

#

case "1" compares it with "1"

#

case "2" compares it with "2"

#

etc

dim wadi
#

can we switch these with anything else

gleaming tinsel
#

of course, as i said

#

u can just make it like

#
if choice == "1":
    handle_set...
elif choice == "2":
    handle_update...
#

etc

dim wadi
#

im confusedddd

gleaming tinsel
#

and case _: is a case, which works all the time

#

so it is same as else

dim wadi
#
    choice = print_navigator()
    match choice:
        case "1": handle_reflection()
        case "2": handle_resolutions()
        case "3": handle_challenge()
        case "4":
            print("Exiting the New Year Navigator.")
            exit(0)
        case _: 
            print("Invalid input! Please choose a valid option (1-4).")
            handle_navigator_menu()

if __name__ == "__main__":
    month = input("Enter the current month (numeric): ")
    day = input("Enter the current day (numeric): ")

    if not (month.isnumeric() and day.isnumeric()):
        print("Dates must be numeric values.")
        exit(0)

    month, day = int(month), int(day)
    if not (1 <= month <= 12 and 1 <= day <= 31):
        print("Invalid date! Please enter a valid one.")
        exit(0)

    remaining_days = days_until_new_year(month, day)
    print(f"\nThere are {remaining_days} days left until the New Year!\n")
    print("Time to reflect and set goals!" if remaining_days < 30 else "Plenty of time to plan ahead!")

    while True:
        handle_navigator_menu()```
misty idolBOT
#

Hey @dim wadi!

It looks like you pasted Python code without syntax highlighting.

Please use syntax highlighting to improve the legibility of your code and make it easier for us to help you.

To do this, use the following method:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
You can **edit your original message** to correct your code block.
dim wadi
#

this is the code

#

so i do

#

if choice == "1":
handle_set
elif choice == "2":
handle_update
if choice == "2":
handle_set
elif choice == "3":
handle_update

#

like this??

gleaming tinsel
dim wadi
#

can you do it if possible and explain

#

if thats fine

#

as long as you explain bc i gotta understand

gleaming tinsel
#

handle_set()

#

etc

gleaming tinsel
#

like print

#

if you actually want to EXECUTE it (and executing a function is called "calling" a function)

#

you use () right after the name

#

so its print("hi")

#

or print()

#

same goes for handle_set(), handle_update(), ...

gleaming tinsel
#

its just that you use else: instead of case _:

gleaming tinsel
#

i can explain what it does if you want

dim wadi
#

def handle_navigator_menu():
choice = print_navigator()
if choice == "1":
handle_reflection()
elif choice == "2":
handle_resolutions()
elif choice == "3":
handle_challenge()
elif choice == "4":
print("Exiting the New Year Navigator.")
exit(0)
else:
print("Invalid input! Please choose a valid option (1-4).")
handle_navigator_menu()

misty idolBOT
#

Hey @dim wadi!

It looks like you're trying to paste code into this channel.

Discord has support for Markdown, which allows you to post code with full syntax highlighting. Please use these whenever you paste code, as this helps improve the legibility and makes it easier for us to help you.

To do this, use the following method:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
You can **edit your original message** to correct your code block.
dim wadi
#

correct?

#

@gleaming tinsel

dim wadi
#

sorry for ping

#

okay

#

what about handle+navoigator

#

what should i do

#

i havemnt learn that

gleaming tinsel
#

cuz i think i've seen more than one place with it

dim wadi
#

huh

#

i want to change

#

it

#

navigator menu

#

i cant use it

#

we havent learnt it

gleaming tinsel
#

you mean this right

#

def handle_navigator_menu():
    choice = print_navigator()
    match choice:
        case "1": handle_reflection()
        case "2": handle_resolutions()
        case "3": handle_challenge()
        case "4":
            print("Exiting the New Year Navigator.")
            exit(0)
        case _: 
            print("Invalid input! Please choose a valid option (1-4).")
            handle_navigator_menu()
#

or

#

something else?

gleaming tinsel
dim wadi
#

haha

#

yeah but

#

when you look at like

#

wait

#

so like this is the thing

#

we cant make our assignment

#

using things in python

#

we havent learnt

#

you know

gleaming tinsel
#

yeah, i get it

dim wadi
#

so we have not learnt

#

handle_navigator_menu()

gleaming tinsel
dim wadi
#

how

#

i need to replace it

dim wadi
#

i need to replace the whole handle_navigator_menu

#

it shouldnt be written in the code

gleaming tinsel
#

one second, i'll be afk for a second

dim wadi
#

okay

#

i havent, a guy made me the code because i was studying for midterms

#

i cant use handle_navigator_menu

#

or he will fail me

gleaming tinsel
# dim wadi i cant use handle_navigator_menu

you wrote this right now:

def handle_navigator_menu():
    choice = print_navigator()
    if choice == "1":
        handle_reflection()
    elif choice == "2":
        handle_resolutions()
    elif choice == "3":
        handle_challenge()
    elif choice == "4":
        print("Exiting the New Year Navigator.")
        exit(0)
    else:
        print("Invalid input! Please choose a valid option (1-4).")
        handle_navigator_menu()
dim wadi
#

we are in introduction to programming

gleaming tinsel
#

like you've sent me this

#

this is the replacement

dim wadi
#

yes

#

i did

#

for example.

#

look

gleaming tinsel
#

maybe he can't... i just don't really understand what exactly he can't use or what exactly he's asking for ๐Ÿ˜…

dim wadi
#

i got it

#

so like i can change the function name

#

right

#

to anything

gleaming tinsel
#

as long as you also will call it with a new name

dim wadi
#

how can i do that

gleaming tinsel
# dim wadi how can i do that

like, if you take this code:

def my_function():
    print('hello')

my_function()

if you will replace my_function in the def, but won't do it down below, code won't work.

#

if you're using visual studio code or some sort of an editor like that

#

you can select the text (the function name)

#

then press ctrl f

#

and in "replace" write what you want to replace it with

#

then "replace all"

#

(is that vscode with that screenshot extension?)

#

@dim wadi soo... need anymore help? ๐Ÿ˜… i'll have to go really soon

dim wadi
#

i need help

#

yeah

#

can i all?

#

can we call

gleaming tinsel
dim wadi
#

too late its closing soon

#

at 11:59

gleaming tinsel
#

aw

dim wadi
#

look

#

this is the code now ok?

gleaming tinsel
#

looks fine

#

and as i said

dim wadi
#

whats what you say man...

gleaming tinsel
#

if __name__ == '__main__': does nothing for that program

dim wadi
#

look

gleaming tinsel
#

so you can just

dim wadi
#

really??

#

let me change it then

gleaming tinsel
#

yeah

dim wadi
#

delete right

gleaming tinsel
#

you can just delete the if and put the code down 4 spaces

#
if __name__ == "__main__":
    month = input("Enter the current month (numeric): ")
    day = input("Enter the current day (numeric): ")
    ...

and instead

month = input("Enter the current month (numeric): ")
day = input("Enter the current day (numeric): ")
...
dim wadi
#

resolutions[idx] = ""

#

what is

#

idx

#

what is this

gleaming tinsel
gleaming tinsel
#
            idx = int(choice) - 1
            resolutions[idx] = ""
dim wadi
#

what is all thatt

gleaming tinsel
#

well, you know what int() does?

dim wadi
#

integer

gleaming tinsel
#

yeah, converts a string (text) to a an integer (number)

#

choice is this:

choice = input("Enter which resolution to delete (1-5): ")
dim wadi
#

yrah but whats idx

gleaming tinsel
#

so.. you take that number

#

subtract 1 from it

#

and put it into idx

dim wadi
#

look

gleaming tinsel
#

then resolutions[idx] = ""
it takes the list (resolutions) and sets the item at position idx to ""

dim wadi
#

he did minus 20

#

why??

#

because i added loop

#

his an ass

gleaming tinsel
dim wadi
#

so like i want the code simple

gleaming tinsel
#

what the hell is q3

dim wadi
#

now we learnt loop\

#

so we can use it

#

question 3

#

let me show you last code

#

this is how simple my last code was

#

assignment

#

i need it as simple as this

#

i cant use too much simple stuff

gleaming tinsel
#

just for this?

dim wadi
#

bc if i havent learnt something he does - too much

gleaming tinsel
#
  for i in range(1, 11):
    print(f"{num1} X {i} = {num1 * i} - {num2} X {i} = {num2 * i}")
dim wadi
#

yes..

#

yeah

gleaming tinsel
#

nah bro imagine typing this out manually ๐Ÿ˜ญ

dim wadi
#

i swear

#

can you possibly do the code?

#

like my code kis already done

#

but like

#

make it simple?

gleaming tinsel
#

i mean.. looks simple to me... i have no idea what you've learned ๐Ÿ˜…

#

but this

#
resolutions[:] = ["" for _ in resolutions]
#

pretty sure you dont have idea what that is

#

and haven't learned

dim wadi
#

yeah

#

i havent

#

okay wait

#

look

gleaming tinsel
#

wait... who wrote that code ๐Ÿ’€

gleaming tinsel
dim wadi
#

yes

gleaming tinsel
#

i guess you could write a normal for loop instead

#

you know how list[index] = ... sets an item at an index, right?

#

well

#

you could just iterate through indexes of resolutions, and set it all to "" manually

for index in range(len(resolutions)):
    resolutions[index] = ""
#

i hope you've learned about len(), right?

#

it gives you the amount of items in a collection (in this case a list)

dim wadi
#

im so mad

#

im so mad man

gleaming tinsel
#

so let's assume len(resolutions) is 5, then we have range(5)
which gives you index = 0, 1, 2, 3, 4

dim wadi
#

i dont know coding im 0 in coding

#

all honestly

#

i cant focus

gleaming tinsel
#

๐Ÿ˜ญ

dim wadi
#

too much assignments

#

why the fuck do universities give assignments when we got midterms next week???

#

SOmeone explain?

gleaming tinsel
#

it can be a lot if you're going through it too quickly...

#

but if those are assignments then, well... can't do anything

#

i mean, he probably lacks the overall understanding of how the code even runs, therefore doesn't have a good idea of what most lines even do

#

it gets quite some learning and quite some time to get used to those ideas, though depends on a person

dim wadi
#

can you like

#

tell

#

if a code

#

is from chatgpt

#

or AI

#

give me exampleas

#

please

gleaming tinsel
#

chatgpt code has silly comments in the code, and sometimes is just doing weird things

drowsy dagger
#

If this is for an assignment you should not be using AI or making others code for you. Unless the professor explicitly says you can. That is called cheating

gleaming tinsel
#

@dim wadi well, have to go. Wish you luck

dim wadi
#

thank you

#

can someone detect this

dim wadi
#

no one told the doctor to make a assignment during midterms

#

and he still wants to make another assignment as well tomorrow

#

professor*

#

can you please check if its AI?

#

the code

#

i know man it stresses me out.

#

what comments

#

can you change them and make them 0% AI detectable

#

if possible

#

anything man

#

plz

#

im dying

#

i got an exam tomorrow i wanna study for

#

calculus

#

he gave us 1 week to do the assignment

#

i did prepare for calculus

#

all thats left is derivatives

#

wait

#

by descriptions

#

you mean this?

#

"Write down three things you're grateful for.",
"Spend 5 minutes reflecting on the past year.",
"Think about one new skill you want to learn.",
"Share a New Year's wish with a friend.",
"Write a letter to yourself for next year."

#

oh nvm

misty idolBOT
#
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.