I'm a total beginner in programming. My question is what actually this code does. I think it takes the whole division result from 10, and then calculates mod 10, and prints it. The res
here I think is not a built-in command in Python, and is just a variable used here, but its value is zero.
Here's the code in question:
res=0
num=int(input("Enter a postive integer: "))
while num > 0:
res=res+(num % 10)
num = num // 10
print(res)