python - While n > 1. Decrease n by 1 on each iteration -
i'm working on hackerrank problems , i've looked @ couple of ways take input , loop through it.
what best alternative trying decrease n on each iteration below (as doesn't seem possible).
first_n = int(raw_input()) def findpercentage(n): if n > 1: studentinfo = raw_input() return studentinfo n = n - 1 result = findpercentage(first_n) print result
as i'm knew this, understand logic might flawed. input passed stdin first line listing total number of lines follow. want perform single operation on every line after first line exception of last line i'd perform different operation.
n= int(input()) studentinfo= {} in range(n): inputs= raw_input().split(" ") studentinfo[inputs[0]]= inputs[1:];
this create dictionary studentinfo
names key , list of marks value.
Comments
Post a Comment