In a class 'N' students are asked to bring a dishes as per their roll numbers for example roll number1 brings 1 item, roll number 2 will bring 2 items and so on.write a function that that takes integer N and returns total number of items brought by "N" students. Don't use list,tuple,dictionary and use simple assignment statements,loop and if,else statement
def class_dish(N):
count_dish = 0
for i in range(1, N+1):
count_dish += i
print(count_dish)
class_dish(4)
Comments
Leave a comment