Back to Browse

Python Tutorial: Sum of Digits // a sample problem for beginners

2.3K views
Jul 1, 2020
10:47

In this example I show you how to work through a problem that has you ask the user to enter a series of digits and then display their sum. There's a hitch though: the digits get stored as a string! This means we have to read in the digits from the user all at once as a string, convert the individual digits into integers, and then add them up. To do this, we'll need to use our knowledge of strings, conversion functions, sequences, and loops. A deceptively simple problem to solve. Let's get to it!

Download

0 formats

No download links available.

Python Tutorial: Sum of Digits // a sample problem for beginners | NatokHD