Python ask for two numbers and print the sum

Vinci Sharma
Apr 24, 2021

--

The challenge is to ask the user for two numbers and print the sum. This makes use of the functions print, input, int and the addition operator to add the two numbers.

Below is the sample solution and some important takeaways.

first_number , second_number, sum_of_nums are variables.

the input function receives input from the keyboard and always returns a string

to perform any further meaningful mathematical operations the string is first converted to integer using int()

You can view more Python challenges here. If you like what you see and want to read more, please follow me on Medium or connect with me on LinkedIn.

--

--