if statement only executes else block
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I am making a program which makes a mark list with a letter grade in python.
But the problem is the if-else statements to decide letter grade is only executing else statement when given inputs. But the if statement for 'A+' grade is working if maximum marks are given. I am a newbie and I can't understand where the bug is, please help. Below is my python code, here datails.html collects information from the user and mark list is displayed in the results.html page.
from flask import Flask, render_template, request
app=Flask(__name__)
@app.route("/")
def index():
return render_template('details.html')
@app.route("/send",methods=['POST','GET'])
def send():
if(request.method=='POST'):
getname=request.form['name']
getregno=request.form['regno']
getcollege=request.form['college']
getsem=request.form['sem']
getsub1=request.form['sub1']
getsub1m=request.form['sub1m']
getsub2=request.form['sub2']
getsub2m=request.form['sub2m']
getsub3=request.form['sub3']
getsub3m=request.form['sub3m']
getsub4=request.form['sub4']
getsub4m=request.form['sub4m']
malayalam_mark = int(getsub1)
malayalam_maxmark = int(getsub1m)
english_mark = int(getsub2)
english_maxmark = int(getsub2m)
maths_mark = int(getsub3)
maths_maxmark = int(getsub3m)
computer_mark = int(getsub4)
computer_maxmark = int(getsub4m)
percent_malayalam = malayalam_mark/malayalam_maxmark*100
percent_english = english_mark/english_maxmark*100
percent_maths = maths_mark/maths_maxmark*100
percent_computer = computer_mark/computer_maxmark*100
slist= [percent_malayalam,percent_english,percent_maths,percent_computer]
result_list=
for i in slist:
if i>=50 and i<58:
grade='D+'
result='pass'
elif i>=58 and i<65:
grade='C'
result='Pass'
elif i>=65 and i<72:
grade='C+'
result='Pass'
elif i>=72 and i<79:
grade='B'
result='Pass'
elif i>=79 and i<86:
grade='B+'
result='Pass'
elif i>=86 and i<93:
grade='A'
result='Pass'
elif i>=93 and i<=100:
grade='A+'
result='Pass'
else:
grade='D'
result='Fail'
result_list.append(grade)
result_list.append(result)
return render_template('/results.html',list=result_list,a=getname,b=getregno,c=getsem,d=getcollege,e=getsub1,e1=getsub1m,f=getsub2,f1=getsub2m,g=getsub3,g1=getsub3m,h=getsub4,h1=getsub4m)
if(__name__=='__main__'):
app.run(debug=True)
I am including a result page, here I included the final list in the bottom for reference, you can find that every input gives grade 'D' and result 'Fail' except maximum marks.
python flask
|
show 1 more comment
I am making a program which makes a mark list with a letter grade in python.
But the problem is the if-else statements to decide letter grade is only executing else statement when given inputs. But the if statement for 'A+' grade is working if maximum marks are given. I am a newbie and I can't understand where the bug is, please help. Below is my python code, here datails.html collects information from the user and mark list is displayed in the results.html page.
from flask import Flask, render_template, request
app=Flask(__name__)
@app.route("/")
def index():
return render_template('details.html')
@app.route("/send",methods=['POST','GET'])
def send():
if(request.method=='POST'):
getname=request.form['name']
getregno=request.form['regno']
getcollege=request.form['college']
getsem=request.form['sem']
getsub1=request.form['sub1']
getsub1m=request.form['sub1m']
getsub2=request.form['sub2']
getsub2m=request.form['sub2m']
getsub3=request.form['sub3']
getsub3m=request.form['sub3m']
getsub4=request.form['sub4']
getsub4m=request.form['sub4m']
malayalam_mark = int(getsub1)
malayalam_maxmark = int(getsub1m)
english_mark = int(getsub2)
english_maxmark = int(getsub2m)
maths_mark = int(getsub3)
maths_maxmark = int(getsub3m)
computer_mark = int(getsub4)
computer_maxmark = int(getsub4m)
percent_malayalam = malayalam_mark/malayalam_maxmark*100
percent_english = english_mark/english_maxmark*100
percent_maths = maths_mark/maths_maxmark*100
percent_computer = computer_mark/computer_maxmark*100
slist= [percent_malayalam,percent_english,percent_maths,percent_computer]
result_list=
for i in slist:
if i>=50 and i<58:
grade='D+'
result='pass'
elif i>=58 and i<65:
grade='C'
result='Pass'
elif i>=65 and i<72:
grade='C+'
result='Pass'
elif i>=72 and i<79:
grade='B'
result='Pass'
elif i>=79 and i<86:
grade='B+'
result='Pass'
elif i>=86 and i<93:
grade='A'
result='Pass'
elif i>=93 and i<=100:
grade='A+'
result='Pass'
else:
grade='D'
result='Fail'
result_list.append(grade)
result_list.append(result)
return render_template('/results.html',list=result_list,a=getname,b=getregno,c=getsem,d=getcollege,e=getsub1,e1=getsub1m,f=getsub2,f1=getsub2m,g=getsub3,g1=getsub3m,h=getsub4,h1=getsub4m)
if(__name__=='__main__'):
app.run(debug=True)
I am including a result page, here I included the final list in the bottom for reference, you can find that every input gives grade 'D' and result 'Fail' except maximum marks.
python flask
3
Whatever is being evaluated is not evaluating to true on any of them. Check your input data, verify what you're expecting then debug and follow the data through to verify that the data you expect exists. If the data is exactly what you expect then the if logic is broken, if the data is not what you're expecting then manipulate the data or alter the if logic to match. Likely something in the initial data manipulation is not outputting what you're expecting.
– Lady_A
Nov 16 '18 at 17:34
Any chance you can print some of the interim variables, like getsub1 and malayalam_maxmark? The math might be wrong because those variables aren't turning into what you'd expect. Also, anything from details.html (anonymized/scrubbed, of course) would be helpful to see as well!
– user2752159
Nov 16 '18 at 17:36
2
Confirm thatslistlooks like what you think it looks like
– tom
Nov 16 '18 at 17:36
Welcome to StackOverflow. Please read and follow the posting guidelines in the help documentation, as suggested when you created this account. Minimal, complete, verifiable example applies here. We cannot effectively help you until you post your MCVE code and accurately describe the problem. We should be able to paste your posted code into a text file and reproduce the problem you described. In particular, if your problem is with the operation of the grade assignment, then the code above that point should be only assigning a short sequence toslist.
– Prune
Nov 16 '18 at 17:41
The if/else statements have been proven to be reliable millions if not billions of times over. The only valid conclusion you can draw is that your data isn't what you think it is
– Bryan Oakley
Nov 16 '18 at 17:42
|
show 1 more comment
I am making a program which makes a mark list with a letter grade in python.
But the problem is the if-else statements to decide letter grade is only executing else statement when given inputs. But the if statement for 'A+' grade is working if maximum marks are given. I am a newbie and I can't understand where the bug is, please help. Below is my python code, here datails.html collects information from the user and mark list is displayed in the results.html page.
from flask import Flask, render_template, request
app=Flask(__name__)
@app.route("/")
def index():
return render_template('details.html')
@app.route("/send",methods=['POST','GET'])
def send():
if(request.method=='POST'):
getname=request.form['name']
getregno=request.form['regno']
getcollege=request.form['college']
getsem=request.form['sem']
getsub1=request.form['sub1']
getsub1m=request.form['sub1m']
getsub2=request.form['sub2']
getsub2m=request.form['sub2m']
getsub3=request.form['sub3']
getsub3m=request.form['sub3m']
getsub4=request.form['sub4']
getsub4m=request.form['sub4m']
malayalam_mark = int(getsub1)
malayalam_maxmark = int(getsub1m)
english_mark = int(getsub2)
english_maxmark = int(getsub2m)
maths_mark = int(getsub3)
maths_maxmark = int(getsub3m)
computer_mark = int(getsub4)
computer_maxmark = int(getsub4m)
percent_malayalam = malayalam_mark/malayalam_maxmark*100
percent_english = english_mark/english_maxmark*100
percent_maths = maths_mark/maths_maxmark*100
percent_computer = computer_mark/computer_maxmark*100
slist= [percent_malayalam,percent_english,percent_maths,percent_computer]
result_list=
for i in slist:
if i>=50 and i<58:
grade='D+'
result='pass'
elif i>=58 and i<65:
grade='C'
result='Pass'
elif i>=65 and i<72:
grade='C+'
result='Pass'
elif i>=72 and i<79:
grade='B'
result='Pass'
elif i>=79 and i<86:
grade='B+'
result='Pass'
elif i>=86 and i<93:
grade='A'
result='Pass'
elif i>=93 and i<=100:
grade='A+'
result='Pass'
else:
grade='D'
result='Fail'
result_list.append(grade)
result_list.append(result)
return render_template('/results.html',list=result_list,a=getname,b=getregno,c=getsem,d=getcollege,e=getsub1,e1=getsub1m,f=getsub2,f1=getsub2m,g=getsub3,g1=getsub3m,h=getsub4,h1=getsub4m)
if(__name__=='__main__'):
app.run(debug=True)
I am including a result page, here I included the final list in the bottom for reference, you can find that every input gives grade 'D' and result 'Fail' except maximum marks.
python flask
I am making a program which makes a mark list with a letter grade in python.
But the problem is the if-else statements to decide letter grade is only executing else statement when given inputs. But the if statement for 'A+' grade is working if maximum marks are given. I am a newbie and I can't understand where the bug is, please help. Below is my python code, here datails.html collects information from the user and mark list is displayed in the results.html page.
from flask import Flask, render_template, request
app=Flask(__name__)
@app.route("/")
def index():
return render_template('details.html')
@app.route("/send",methods=['POST','GET'])
def send():
if(request.method=='POST'):
getname=request.form['name']
getregno=request.form['regno']
getcollege=request.form['college']
getsem=request.form['sem']
getsub1=request.form['sub1']
getsub1m=request.form['sub1m']
getsub2=request.form['sub2']
getsub2m=request.form['sub2m']
getsub3=request.form['sub3']
getsub3m=request.form['sub3m']
getsub4=request.form['sub4']
getsub4m=request.form['sub4m']
malayalam_mark = int(getsub1)
malayalam_maxmark = int(getsub1m)
english_mark = int(getsub2)
english_maxmark = int(getsub2m)
maths_mark = int(getsub3)
maths_maxmark = int(getsub3m)
computer_mark = int(getsub4)
computer_maxmark = int(getsub4m)
percent_malayalam = malayalam_mark/malayalam_maxmark*100
percent_english = english_mark/english_maxmark*100
percent_maths = maths_mark/maths_maxmark*100
percent_computer = computer_mark/computer_maxmark*100
slist= [percent_malayalam,percent_english,percent_maths,percent_computer]
result_list=
for i in slist:
if i>=50 and i<58:
grade='D+'
result='pass'
elif i>=58 and i<65:
grade='C'
result='Pass'
elif i>=65 and i<72:
grade='C+'
result='Pass'
elif i>=72 and i<79:
grade='B'
result='Pass'
elif i>=79 and i<86:
grade='B+'
result='Pass'
elif i>=86 and i<93:
grade='A'
result='Pass'
elif i>=93 and i<=100:
grade='A+'
result='Pass'
else:
grade='D'
result='Fail'
result_list.append(grade)
result_list.append(result)
return render_template('/results.html',list=result_list,a=getname,b=getregno,c=getsem,d=getcollege,e=getsub1,e1=getsub1m,f=getsub2,f1=getsub2m,g=getsub3,g1=getsub3m,h=getsub4,h1=getsub4m)
if(__name__=='__main__'):
app.run(debug=True)
I am including a result page, here I included the final list in the bottom for reference, you can find that every input gives grade 'D' and result 'Fail' except maximum marks.
python flask
python flask
edited Nov 16 '18 at 17:37
Vivi
asked Nov 16 '18 at 17:30
ViviVivi
145
145
3
Whatever is being evaluated is not evaluating to true on any of them. Check your input data, verify what you're expecting then debug and follow the data through to verify that the data you expect exists. If the data is exactly what you expect then the if logic is broken, if the data is not what you're expecting then manipulate the data or alter the if logic to match. Likely something in the initial data manipulation is not outputting what you're expecting.
– Lady_A
Nov 16 '18 at 17:34
Any chance you can print some of the interim variables, like getsub1 and malayalam_maxmark? The math might be wrong because those variables aren't turning into what you'd expect. Also, anything from details.html (anonymized/scrubbed, of course) would be helpful to see as well!
– user2752159
Nov 16 '18 at 17:36
2
Confirm thatslistlooks like what you think it looks like
– tom
Nov 16 '18 at 17:36
Welcome to StackOverflow. Please read and follow the posting guidelines in the help documentation, as suggested when you created this account. Minimal, complete, verifiable example applies here. We cannot effectively help you until you post your MCVE code and accurately describe the problem. We should be able to paste your posted code into a text file and reproduce the problem you described. In particular, if your problem is with the operation of the grade assignment, then the code above that point should be only assigning a short sequence toslist.
– Prune
Nov 16 '18 at 17:41
The if/else statements have been proven to be reliable millions if not billions of times over. The only valid conclusion you can draw is that your data isn't what you think it is
– Bryan Oakley
Nov 16 '18 at 17:42
|
show 1 more comment
3
Whatever is being evaluated is not evaluating to true on any of them. Check your input data, verify what you're expecting then debug and follow the data through to verify that the data you expect exists. If the data is exactly what you expect then the if logic is broken, if the data is not what you're expecting then manipulate the data or alter the if logic to match. Likely something in the initial data manipulation is not outputting what you're expecting.
– Lady_A
Nov 16 '18 at 17:34
Any chance you can print some of the interim variables, like getsub1 and malayalam_maxmark? The math might be wrong because those variables aren't turning into what you'd expect. Also, anything from details.html (anonymized/scrubbed, of course) would be helpful to see as well!
– user2752159
Nov 16 '18 at 17:36
2
Confirm thatslistlooks like what you think it looks like
– tom
Nov 16 '18 at 17:36
Welcome to StackOverflow. Please read and follow the posting guidelines in the help documentation, as suggested when you created this account. Minimal, complete, verifiable example applies here. We cannot effectively help you until you post your MCVE code and accurately describe the problem. We should be able to paste your posted code into a text file and reproduce the problem you described. In particular, if your problem is with the operation of the grade assignment, then the code above that point should be only assigning a short sequence toslist.
– Prune
Nov 16 '18 at 17:41
The if/else statements have been proven to be reliable millions if not billions of times over. The only valid conclusion you can draw is that your data isn't what you think it is
– Bryan Oakley
Nov 16 '18 at 17:42
3
3
Whatever is being evaluated is not evaluating to true on any of them. Check your input data, verify what you're expecting then debug and follow the data through to verify that the data you expect exists. If the data is exactly what you expect then the if logic is broken, if the data is not what you're expecting then manipulate the data or alter the if logic to match. Likely something in the initial data manipulation is not outputting what you're expecting.
– Lady_A
Nov 16 '18 at 17:34
Whatever is being evaluated is not evaluating to true on any of them. Check your input data, verify what you're expecting then debug and follow the data through to verify that the data you expect exists. If the data is exactly what you expect then the if logic is broken, if the data is not what you're expecting then manipulate the data or alter the if logic to match. Likely something in the initial data manipulation is not outputting what you're expecting.
– Lady_A
Nov 16 '18 at 17:34
Any chance you can print some of the interim variables, like getsub1 and malayalam_maxmark? The math might be wrong because those variables aren't turning into what you'd expect. Also, anything from details.html (anonymized/scrubbed, of course) would be helpful to see as well!
– user2752159
Nov 16 '18 at 17:36
Any chance you can print some of the interim variables, like getsub1 and malayalam_maxmark? The math might be wrong because those variables aren't turning into what you'd expect. Also, anything from details.html (anonymized/scrubbed, of course) would be helpful to see as well!
– user2752159
Nov 16 '18 at 17:36
2
2
Confirm that
slist looks like what you think it looks like– tom
Nov 16 '18 at 17:36
Confirm that
slist looks like what you think it looks like– tom
Nov 16 '18 at 17:36
Welcome to StackOverflow. Please read and follow the posting guidelines in the help documentation, as suggested when you created this account. Minimal, complete, verifiable example applies here. We cannot effectively help you until you post your MCVE code and accurately describe the problem. We should be able to paste your posted code into a text file and reproduce the problem you described. In particular, if your problem is with the operation of the grade assignment, then the code above that point should be only assigning a short sequence to
slist.– Prune
Nov 16 '18 at 17:41
Welcome to StackOverflow. Please read and follow the posting guidelines in the help documentation, as suggested when you created this account. Minimal, complete, verifiable example applies here. We cannot effectively help you until you post your MCVE code and accurately describe the problem. We should be able to paste your posted code into a text file and reproduce the problem you described. In particular, if your problem is with the operation of the grade assignment, then the code above that point should be only assigning a short sequence to
slist.– Prune
Nov 16 '18 at 17:41
The if/else statements have been proven to be reliable millions if not billions of times over. The only valid conclusion you can draw is that your data isn't what you think it is
– Bryan Oakley
Nov 16 '18 at 17:42
The if/else statements have been proven to be reliable millions if not billions of times over. The only valid conclusion you can draw is that your data isn't what you think it is
– Bryan Oakley
Nov 16 '18 at 17:42
|
show 1 more comment
1 Answer
1
active
oldest
votes
I guess this is being run in Python 2 which doesn't automatically promote integer division. If you rearrange your calculations like:
percent_malayalam = malayalam_mark * 100 / malayalam_maxmark
you might get the right answer… Previously all non-100% results were being (implicitly) rounded to 0%. 2 / 3 in Python 2 will be 0, not ~0.6. The defaults have been changed in Python 3 so it tends to do the right thing more often.
You could then read about integer division in Python 2 from various places, here's one at this site: What is the difference between '/' and '//' when used for division?
That worked, Thank you Sam Mason
– Vivi
Nov 16 '18 at 18:03
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53342726%2fif-statement-only-executes-else-block%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I guess this is being run in Python 2 which doesn't automatically promote integer division. If you rearrange your calculations like:
percent_malayalam = malayalam_mark * 100 / malayalam_maxmark
you might get the right answer… Previously all non-100% results were being (implicitly) rounded to 0%. 2 / 3 in Python 2 will be 0, not ~0.6. The defaults have been changed in Python 3 so it tends to do the right thing more often.
You could then read about integer division in Python 2 from various places, here's one at this site: What is the difference between '/' and '//' when used for division?
That worked, Thank you Sam Mason
– Vivi
Nov 16 '18 at 18:03
add a comment |
I guess this is being run in Python 2 which doesn't automatically promote integer division. If you rearrange your calculations like:
percent_malayalam = malayalam_mark * 100 / malayalam_maxmark
you might get the right answer… Previously all non-100% results were being (implicitly) rounded to 0%. 2 / 3 in Python 2 will be 0, not ~0.6. The defaults have been changed in Python 3 so it tends to do the right thing more often.
You could then read about integer division in Python 2 from various places, here's one at this site: What is the difference between '/' and '//' when used for division?
That worked, Thank you Sam Mason
– Vivi
Nov 16 '18 at 18:03
add a comment |
I guess this is being run in Python 2 which doesn't automatically promote integer division. If you rearrange your calculations like:
percent_malayalam = malayalam_mark * 100 / malayalam_maxmark
you might get the right answer… Previously all non-100% results were being (implicitly) rounded to 0%. 2 / 3 in Python 2 will be 0, not ~0.6. The defaults have been changed in Python 3 so it tends to do the right thing more often.
You could then read about integer division in Python 2 from various places, here's one at this site: What is the difference between '/' and '//' when used for division?
I guess this is being run in Python 2 which doesn't automatically promote integer division. If you rearrange your calculations like:
percent_malayalam = malayalam_mark * 100 / malayalam_maxmark
you might get the right answer… Previously all non-100% results were being (implicitly) rounded to 0%. 2 / 3 in Python 2 will be 0, not ~0.6. The defaults have been changed in Python 3 so it tends to do the right thing more often.
You could then read about integer division in Python 2 from various places, here's one at this site: What is the difference between '/' and '//' when used for division?
answered Nov 16 '18 at 17:43
Sam MasonSam Mason
3,36811331
3,36811331
That worked, Thank you Sam Mason
– Vivi
Nov 16 '18 at 18:03
add a comment |
That worked, Thank you Sam Mason
– Vivi
Nov 16 '18 at 18:03
That worked, Thank you Sam Mason
– Vivi
Nov 16 '18 at 18:03
That worked, Thank you Sam Mason
– Vivi
Nov 16 '18 at 18:03
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53342726%2fif-statement-only-executes-else-block%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
Whatever is being evaluated is not evaluating to true on any of them. Check your input data, verify what you're expecting then debug and follow the data through to verify that the data you expect exists. If the data is exactly what you expect then the if logic is broken, if the data is not what you're expecting then manipulate the data or alter the if logic to match. Likely something in the initial data manipulation is not outputting what you're expecting.
– Lady_A
Nov 16 '18 at 17:34
Any chance you can print some of the interim variables, like getsub1 and malayalam_maxmark? The math might be wrong because those variables aren't turning into what you'd expect. Also, anything from details.html (anonymized/scrubbed, of course) would be helpful to see as well!
– user2752159
Nov 16 '18 at 17:36
2
Confirm that
slistlooks like what you think it looks like– tom
Nov 16 '18 at 17:36
Welcome to StackOverflow. Please read and follow the posting guidelines in the help documentation, as suggested when you created this account. Minimal, complete, verifiable example applies here. We cannot effectively help you until you post your MCVE code and accurately describe the problem. We should be able to paste your posted code into a text file and reproduce the problem you described. In particular, if your problem is with the operation of the grade assignment, then the code above that point should be only assigning a short sequence to
slist.– Prune
Nov 16 '18 at 17:41
The if/else statements have been proven to be reliable millions if not billions of times over. The only valid conclusion you can draw is that your data isn't what you think it is
– Bryan Oakley
Nov 16 '18 at 17:42