basically, im supposed to write a code where you input your overall average in a class, you input your midterm exam test grade, and then use those two to calculate what grade you need in the final exam to pass, the problem is i dont know how to convert this mathematical equation to python code and i also am not fully sure how the equation works.
#๐ Coding help
28 messages ยท Page 1 of 1 (latest)
@hard spindle
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.
Closes after a period of inactivity, or when you send !close.
code so far:
overall = int(input("What is your Overall Mark?: "))
print(overall)
if 0 < overall <=100:
average = int(input("What was your Midterm Average? "))
else:
print("Your Overall has to be between 0 - 100 ")
if 0 < average <=100:
print(average)
else:
print("Your Average has to be between 0 - 100")
The equation is just basic math. Use () parenthesis to keep the order of operations straight.
i know its basic math but I'm not entirely sure how to write it in code, im pretty new.
Do you know PEMDAS as in order of operations?
yeah parenthesis, exponents, multiplication, division, addition, subtraction. i think i got it written down but its giving me the wrong answer.
!code
overall = int(input("What is your Overall Mark?: "))
print(overall)
if 0 < overall <=100:
average = int(input("What was your Midterm Average? "))
else:
print("Your Overall has to be between 0 - 100 ")
if 0 < average <=100:
print(average)
needed = ((50 + average - overall)*0.6)/0.4
print (needed)
else:
print("Your Average has to be between 0 - 100")
if i input 100 for both the overall and average, "needed" is supposed to come out as 20, instead it came out as 75, so now im confused.
I think it is term(dash)average not term(minus)average
So the midterm must be included in term average
so add them instead of subtract, okay.
oh no thats very very wrong, it came out as 375
No you have to average them by hand before. Please post instructions
yeah thats a good idea one sec
i had too DM you them because it wont let me post PDFs
sorry I'm trying my best but I'm sick, stressed, and have a headache and am very confused lol but i am trying. lol
that also dosent work, it comes out as 200 if both the average and midterm input is 100.
from the first picture on page 3 in the pdf, if both inputs are 100, the output should be 20
Yeah that is a lot. I don't get what they want either. Sorry.
Thatโs alright Iโm still super confused Iโll just keep trying until I get it or someone else is able to help me figure it out.
!close
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.