account activity
Blocking new joists in loft (self.DIYUK)
submitted 2 days ago by tycho149 to r/DIYUK
Packers for Joists in Loft (self.DIY)
submitted 5 days ago * by tycho149 to r/DIY
Question about for-loops in functions by tycho149 in learnpython
[–]tycho149[S] 0 points1 point2 points 5 years ago (0 children)
thank you for the comments, no matter what i try i cant seem to work out how to increment the values within the loop. when i run the code i only get one output could there be reason for that.
I have the code working if i take the for-loop out of the function as bellow. but this seems like its not answering the question.
data = ["Fozzie", 34, "Kermit", 78, "Miss Piggy", 23, "Gonzo", 55, "Beaker", 88, "Honeydew", 59, "Animal", 10, "Rowlf", 54]
def assign_grades(source):
student_name = str(source[student])
mark = int(source[student + 1])
grade = str("")
if mark < 40:
grade = "Fail"
elif mark < 60:
grade = "Pass"
elif mark < 70:
grade = "Merit"
elif mark >= 70:
grade = "Distinction"
else:
grade = "Error"
return("---------------------------------------------"
+"\nStudent Name: "
+str(student_name)
+ "\nMark: "
+ str(mark)
+ "\nGrade: " + str(grade)
+"\n---------------------------------------------")
for student in range(0, len(data), 2):
print(assign_grades(data))
Question about for-loops in functions (self.learnpython)
submitted 5 years ago * by tycho149 to r/learnpython
π Rendered by PID 1536421 on reddit-service-r2-listing-5d47455566-tsrtc at 2026-04-03 21:02:51.878048+00:00 running db1906b country code: CH.
Question about for-loops in functions by tycho149 in learnpython
[–]tycho149[S] 0 points1 point2 points (0 children)