Computer Science, asked by aprajit2005, 4 months ago

python program


WAP to take marks in 3 subjects from the user, find the total and percentages. Assign the

grades according to the following

<40 % D

>= 40 and <60 C

>=60 and <80 B

>= 80 A​

Answers

Answered by allysia
2

Answer:

It goes like:

\\\tt a= int( inpu t("Enter\ mark\ of\ sub1: ")) \\\tt b= int( inpu t("Enter\ mark\ of\ sub2: ")) \\\tt c= int( inpu t("Enter\ mark\ of\ sub3: ")) \\\tt total=300 \\\tt per=((a+b+c)/total)*100 \\\tt if\ per&lt;40:  \\\tt  {\qquad print("D")} \\\tt elif\ per&gt;=40\ and\ per&lt;60:  \\\tt  {\qquad print("C")} \\\tt elif\ per&gt;=60\ and\ per&lt;80:  \\\tt  {\qquad print("B")} \\\tt else:  \\\tt  {\qquad print("A")}

Explanation:

  • Got in input values and saved it in variables.
  • Saved percentage value in per.
  • Used if-elif-else statements to check what to print.

Similar questions