I am incredibly new to coding and also currently self taught. Learning python and am in desperate need of assistance so I can help my younger cousin with homework! We are basically learning together and are both stumped on a particular assignment with if/then statements. Help understanding what we are doing wrong and what the assertion error means would be amazing!
I’m not completely sure if I posted the snippet of code correctly so any helpful tips and hits would be welcome! Repl link:https://replit.com/@jroman3/Ifthen-practice#main.py
def check_payday(payday):
if check_payday == "date":
print("Time to pay rent.")
else:
print("Keep calm and eat two minute noodles.")
As it is an assignment that I am trying to help on, I’m honestly not all too sure what I’m looking for. But the assignment states the following:
Within the function check_payday() below:
Write an if statement that checks to see if “date” is equal to the string “payday”.
If it is, then print “Time to pay rent.”
If it isn’t equal to payday then print “Keep calm and eat two minute noodles.”
Hint: Remember your indentation!
I feel like the error may be in line 1 of the code but again I’m not sure! Thank you for such a quick reply! I’m sorry that I’m a noob and don’t fully know what you need in order for you to best help haha
I really don’t think you should be posting your school / uni assignments to this forum. It’s not right to expect others to do the work for you and your tutor will not understand how to help you if you are submitting work from someone else.
Please feel free to post questions that will help you understand the building blocks of programs, but don’t post tasks again.
I actually am the tutor. I get paid to assist kids with school work (mind you I don’t get paid to help my cousin), however I have been recently asked to help with coding. While I explained to my cousin’s parents that I am not equipped for that, they asked if I could possibly learn along with him and help with the assignments that he gets stuck on/has to redo.
While I fully understand and respect your opinion, I would not be posting for this help if it were my own homework assignment. I work two full time jobs outside of tutoring for family and friends, and I am now being asked to help with something that I know next to nothing about. Instead of scrutinizing someone for their situation (which you are not fully aware of) I would appreciate those who are willing to assist and aid me. I am doing my best here. I want my cousin to pass this class, but in order to help him I have to receive help first. While helping him I thought it would be cool to try and learn something new and challenging myself, but it’s getting to a point where I need help too.
Thank you for the nudge!! As I just stated, it’s not an assignment for me haha I tutor my cousin (and other kids) and was recently asked to help with coding. I’m the tutor that needs a tutor hahaha but I swear I’m not trying to directly give my cousin the answer, but I can’t help him if I don’t even know waht it is
I didn’t mean for it to come off as mean. I am personally frustrated with this assignment, myself for not figuring it out, and the overall situation. When I finally reached out to the great wide web for help, I really didn’t appreciate having a reply that was basically questioning my dignity.
All I’m asking for is help – I read the guidelines, I know you aren’t supposed to ask for answers here if you’re working on homework or an assignment. While the question is in regards to a school assignment, I figured it would be okay as it is not my assignment and I am the tutor. I should have made that clear from the start, that was definitely my mistake.
Again, my apologies if you think I was being mean. Hopefully you can get a better understanding of where I’m coming from.
Your if statement is this: if check_payday == "date":. There are two things wrong with this. You should double check what you’re testing if the string is equal to, but more importantly, what is check_payday? Look at where and how check_payday is defined. Remember you want to check if the parameter in the function is equal to a certain string.