Exam Statistics_Print those grades


#1

How to print on a new line in python
What is the format(\n ?)

grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5]

def print_grades(grades):
for grade in grades:
print grade \n


#2

yea, but as string:

"\n"

so you need to concat string and variable

also, the for loop will print each one on new line


#3

i did normal print .
It got printed.no \n nothing !!

grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5]

def print_grades(grades):
for grade in grades:
print grade

print_grades(grades)


#4

how is this possible


#5

each print statement prints on a new line by default


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.