Python Source code to Add two Numbers Without Addition Operator

preview_player
Показать описание
In This Video,
We will write a Python Program From Scratch:
to Add the Numbers Without using The Addition Operator !!!

We used For-loop to increment the first number in each iteration while variable "i" starts from 1 till the second number using the:
for i in range(initial,final+1),
final +1 because range starts from initial and stops before final, So to include the final we have to increment it with 1.
This made the summation to be stored in the variable "sum",and we printed it on the screen.

We called the function, stored returned(summation) value in another variable ("sum") ,and printed it in the function only, we used the same logic of For-loop

Do Like 👍 Share 💖✨ and Subscribe 👑✨

Also Comment Down Below 👇 if you have any questions ☺️

Complete Tutorials:

C Language Playlist:

JAVA Playlist:

Python Playlist:

PHP & JavaScript (Web Technology) Playlist:
Рекомендации по теме
Комментарии
Автор

Hello, could you please explain why the output is 7 here?

def sum_of_digits(n):
t = 0
while n != 0:
r = n%10
t = t + r
n = n//10
return t
print(sum_of_digits(1123))

liri