College student here with no experience in coding. I just started playing around with python because I'm worried I'll need coding knowledge for my career and so I want to introduce myself to it with a simpler language. This is the "default" solution. It correctly asserts and calculates all values. My confusion here comes from lines 2, 5 and 7. I understand how to convert an argument, but I don't understand how # works in this context, the necessity of the line result = 1, or anything about line 7. Can someone help me out?
def checkio(number: int)-> int:
result = 1
for s in str(number):
n = int(s)
if not n: # if n == 0
continue
result *= n # result = result * n
return result
Created at: Nov. 23, 2019, 5:58 a.m.; Updated at: Nov. 23, 2019, 7:37 a.m.