Hi all,
Sorry for what is probably a really stupid question but, I started a data analytics course this week, having never done any coding before and unfortunately the tutor wasn't great for absolute beginners.
We have been set a lot of homework, most of which I have managed to workout but, I am stuck with just one thing.
The print I do at the end, how do I get it all to align in 3 perfect columns and how do I add titles at of the columns? For the former I have tried just about everything and I think I am making myself more and more confused.
Thanks for your help.
Sorry for what is probably a really stupid question but, I started a data analytics course this week, having never done any coding before and unfortunately the tutor wasn't great for absolute beginners.
We have been set a lot of homework, most of which I have managed to workout but, I am stuck with just one thing.
The print I do at the end, how do I get it all to align in 3 perfect columns and how do I add titles at of the columns? For the former I have tried just about everything and I think I am making myself more and more confused.
Thanks for your help.
gm = 0 gm1 = 0 gm2 = 0 gm3 = 0 gm4 = 0 gm5 = 0 gm6 = 0 gm7 = 0 gm8 = 0 gm9 = 0 for x in data: if x in range(0,10): gm += 1 elif x in range(10,20): gm1 += 1 elif x in range(20,30): gm2 += 1 elif x in range(30,40): gm3 += 1 elif x in range(40,50): gm4 += 1 elif x in range(50,60): gm5 += 1 elif x in range(60,70): gm6 += 1 elif x in range(70,80): gm7 += 1 elif x in range(80,90): gm8 += 1 elif x in range(90,100): gm9 += 1 grademark = [gm,gm1,gm2,gm3,gm4,gm5,gm6,gm7,gm8,gm9] grades = ["0 - 10", "10 - 20", "20 - 30 ", "30 -40", "40-50", "50 - 60", "60 - 70", "70 - 80 ", "80 - 90", "90 - 100"] for i in range(len(grades)): print("{:}{:6}{:6}".format(grades[i], grademark[i],'*' * grademark[i]))Moderator Note: Closing python tag needs '/' preceeding 'python'