#๐ Please help, problem with assignment.
292 messages ยท Page 1 of 1 (latest)
@dim wadi
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.
hello
@dim wadi if your original message contained a file, then upload it with a python's pastebin website
!paste
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.
here's the link
could you possibly help
now, what's the issue ur facing ?
handle_navigator_menu()
i havent learnt it]
i cant use it..
some guy made me this code bc i got midterms
so, u just want an explanation ?
so, can't use match case ?
and i have not learnt if name == "main": also
yess
match case in that .. case.. is just an exact replacement of a bunch of if elif statements
we need to do the bunch of elif statements haha
co, case "1" is basically comparing match var like if var == "1"
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?
var is just any variable name
yeah we did learn variables
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
what even is case
match choice means... you're comparing the choice variable
case "1" compares it with "1"
case "2" compares it with "2"
etc
can we switch these with anything else
of course, as i said
u can just make it like
if choice == "1":
handle_set...
elif choice == "2":
handle_update...
etc
im confusedddd
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()```
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.
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??
well, match var takes a variable (let's call it var)
and then executes case which... matches the var
can you do it if possible and explain
if thats fine
as long as you explain bc i gotta understand
sort of, just don't forget that you need to actually call those functions with ()
handle_set()
etc
call them with what
one sec
well, when you have a function
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(), ...
as for the if elif - this is exactly like that
its just that you use else: instead of case _:
and __name__ == "__main__" is completely unecessary - you can just get rid of that if
i can explain what it does if you want
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()
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.
exactly!!
sorry for ping
okay
what about handle+navoigator
what should i do
i havemnt learn that
there's also a match case ?
cuz i think i've seen more than one place with it
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?
ah wait that's what you wrote
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
yeah, i get it
yeah, we fixed that
^
one second, i'll be afk for a second
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
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()
we are in introduction to programming
maybe he can't... i just don't really understand what exactly he can't use or what exactly he's asking for ๐
well, yeah
as long as you also will call it with a new name
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
not now, i'm at work.. i'll be back home in about an 1 hour 30 mins
aw
whats what you say man...
if __name__ == '__main__': does nothing for that program
look
so you can just
yeah
delete right
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): ")
...
if you want, i can explain what exactly it does, but thats if you want
no time
variable name.. lemme look
idx = int(choice) - 1
resolutions[idx] = ""
what is all thatt
well, you know what int() does?
integer
yeah, converts a string (text) to a an integer (number)
choice is this:
choice = input("Enter which resolution to delete (1-5): ")
yrah but whats idx
look
then resolutions[idx] = ""
it takes the list (resolutions) and sets the item at position idx to ""
so like i want the code simple
what the hell is q3
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
just for this?
bc if i havent learnt something he does - too much
for i in range(1, 11):
print(f"{num1} X {i} = {num1 * i} - {num2} X {i} = {num2 * i}")
nah bro imagine typing this out manually ๐ญ
i swear
can you possibly do the code?
like my code kis already done
but like
make it simple?
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
wait... who wrote that code ๐
you guys learned about lists, right?
yes
though, wait, i get it... but well.
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)
so let's assume len(resolutions) is 5, then we have range(5)
which gives you index = 0, 1, 2, 3, 4
๐ญ
too much assignments
why the fuck do universities give assignments when we got midterms next week???
SOmeone explain?
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
well, even a person can
chatgpt code has silly comments in the code, and sometimes is just doing weird things
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
@dim wadi well, have to go. Wish you luck
leave me alone
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
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.