+ 1

Can anyone tell me why I am getting answers 50

https://code.sololearn.com/cENMaAl3EoI7/?ref=app Here first I enter like this 6 100 100 100 100 100 100 100 Then I expected to get output 100.0but I am getting output as 50.0 Why (´;д;`)

1st Jun 2020, 9:56 AM
Kavya Mittal
Kavya Mittal - avatar
5 Respuestas
0
The reason you got 50.0 since when you added subject marks in Addition . Some of the subject was in new line.
2nd Jun 2020, 2:51 AM
SOUMYA
SOUMYA - avatar
+ 2
Total_Subjects = int(input("")) Total_Marks = int(input("")) if Total_Subjects == 6: Subject1 = int(input ("")) Subject2 = int(input ("")) Subject3 = int(input ("")) Subject4 = int(input ("")) Subject5 = int(input ("")) Subject6 = int(input ("")) Sum = Total_Marks * 6 Addition = Subject1 + Subject2 + Subject3 +Subject4 + Subject5 + Subject6 Step2 = Addition/Sum Percent = Step2 * 100 print ( Percent )
1st Jun 2020, 10:38 AM
SOUMYA
SOUMYA - avatar
+ 1
Now check it.
1st Jun 2020, 10:38 AM
SOUMYA
SOUMYA - avatar
2nd Jun 2020, 2:38 AM
SOUMYA
SOUMYA - avatar
0
It will cause an indentation error
2nd Jun 2020, 2:25 AM
Kavya Mittal
Kavya Mittal - avatar