Zhakkas sir Bahut acchey sey cover kiya aapney Sir one request please Ki agar mein aap key python ki puuri playlist follow karunga toh kya mujhe concepts key saath unpar puurey practice problems bhi milengey??? Please tell sir Mujhey aapney doston ko bhi ye course recommend karna hai
@@codeitup Sir ek doubt hai : In python add 10 to even and subtract 2 from odd numbers.. I tried something like : for i in (listname): If i%2==0: X=i+10 List[i]=X (And then the else statment...) But its some kind of run-time error,"list index out of range"..
Because we are extracting the frace value of each of the digits at 10s place, 100s place, 1000s place etc, which is possible by dividing the number only with 10.
Nope, I think you're confused in i//10, as after 1 the n will become 20 which gives the condition r = 2 .. And when you sum the digit we got 3 in this case the program will be done only in 2 steps .. I think I'm bad in explaining lol
def sum_of_digit( n ): if n == 0: return 0 return (n % 10 + sum_of_digit(int(n / 10))) num = int(input("Enter Number:")) result = sum_of_digit(num) print("Sum of digits in",num,"is", result)
Sir, this program can be done using for loop? Cause I made a program to do it. here is the code : # wap to add square of digit of a given number n=int(input("Enter the Number : ")) i=0 sum=0 for i in range(1,n): sum=sum+(n%10)**2 n=n//10 print(sum) please reply, if there is any error
If i>=0,then Then there will be two cases to consider i>0 and i=0 If i=0, then i=sum[since, sum =0] which means the loop will not repeat and therefore the program will remain unexecuted
how to take multiple inputs like Input Format =================> Input : 3 12345 31203 2123 Constraints Constraints - 1 ≤ T ≤ 1000 1 ≤ N ≤ 1000000 Output Format Output : 15 9 8
Nice sir ji,your concept is very easily, thanks sir
🙏
Wah what an english
Job karte hoge bhai ab to aap
Explained in a very easy manner, thanks sir
Hello sir I am from engineering field but your way of teaching is soo easy and simple and understood . Sir would u plz make video for django.
Thank you so much sir ! I like your teaching very much ,God bless you sir , I hope your journey will be very successful 💯😇
Most welcome Prachi.. & thank you so much for your precious comment😊
im in engineering first year and this video helped me a lot. thanks so much.
Sir really excellent explanation.....ek ek step crystal clear ho gya h
Thanks a lot Yogesh 😊
Amazing way to make understand...
Thank U so much sir..
Thanks & most welcome Pratap!
You're very best teacher ❤️
For beginners this video is really helpful
Thanks😊
Thank you so much sir ☺️. Aapne sare confusion hi clear kr diya
Most welcome😊
U HELPED ME DO MY CHOOL ASSIGNMENT THAT'S WHAT I CARE U ARE GOD 🙏
Ur way of teaching is so good sir ❤️❤️❤️
Thanks a million Neha!
Thanks for explaining the logic.
Most welcome Anuj!
Very easy to understand thanks for this video
Glad it helped🙂
Awesome
😊
Nice Explanation
Nicely explained.
Glad you liked it!
I thik such type of teaching is not available in any channel 😅.... thanks you so much sir 😊
Thanks & most welcome😊
I am thinking how well could a teacher teach on youtube? Best cs teacher pn youtube
very nice video sir 🥰🥰🥰
Zhakkas sir
Bahut acchey sey cover kiya aapney
Sir one request please
Ki agar mein aap key python ki puuri playlist follow karunga toh kya mujhe concepts key saath unpar puurey practice problems bhi milengey???
Please tell sir
Mujhey aapney doston ko bhi ye course recommend karna hai
Follow "Complete Python Tutorial" playlist, which will cover every topic step by step and will help you to learn python completely.
@@codeitup thankyou sir ji for quick and helpful reply
Sir digit number koi sa le agar toh har baar 10 se hi modulus krna hai kya ?
Thank you sir. I have cleared all of my doubts.
That's good Poonam, keep learning!
awesome video sir
Thanks😊
Great sir.. your videos are very informative.
Thanks tushar. Keep uploading.
@@codeitup ye Program Recursion se kaise banega .....isko BTA de plzzzz using recursion (sum of digits)
sir how can i tackle such type of questions in future it looks like we have to learn it
?
Crystal Clear ❤️❤️
👍
superb sir keep it up
🙏
Helpful...👍
😊
Sir your all video are very helpful... Thank you so much😊
Glad to help you😊
🙏🙏🙏🤩🤩🤩thanks a lot sir
Most welcome Kiran!
Easy explanation 👍
Please share the playlist of all these questions
Sir isi trh ka interview level ka ek hi full video bna dijiye sir pllz
Thank you so much
Most welcome😊
Great sir
Thanks!
Thank you so much sir
Most welcome Dileep !
@@codeitup sir strong or not eska concept nhi samjh aa raha hai sir please aap strong or not ka bhi program samjha dijiye
n = str(input("write your number: "))
a = int(n[0])
b = int(n[1])
c = int(n[2])
sum = ( a + b + c )
print(sum)
what if number is 556566?
Nice 👍
Thanks !
So nice sir thanks sir
Welcome Anju !!!
THANK YOU SIR...
Most welcome!
Nice video hai❤
😊
sir app ne bataya tha ki while ko run karne keliye 3 condition hoti h per iss video no. 22 me wo condition kase apply ho rhi h please tell ....
Sir " i=i//10 " ki jagah
" i=int(i/10) " bhi use ho sakta hai na..?
Hnji Kar sakte hai...
@@codeitup Sir ek doubt hai :
In python add 10 to even and subtract 2 from odd numbers..
I tried something like :
for i in (listname):
If i%2==0:
X=i+10
List[i]=X
(And then the else statment...)
But its some kind of run-time error,"list index out of range"..
Easiest__We can also apply it
s=input()
sum=0
lt=[]
for i in s:
lt.append(i)
for i in lt:
sum=sum+int(i)
print(sum)
integers are not iterable bro..... so this will not work
@@nikhilbordekarHe is iterating a string not integer brother
Sir, Is question ko krne ka bass yahi ek tarika hai ya koi aur bhi method ho skta hai??
Koi bhi ek question banane ke bahut sare tarike hote hai ! Aur bhi tarike hai..
@@codeitup ha sir bass wahi confirm krna tha, thank you
Nice
Thank you so much sir🙏
Most welcome dear!
Thank you soo much
Most welcome Yuwani!
Sir amake to calculate the sum of the first "n" whole numbers, where "n" is limit accepted from the user. Ai program ti kibhabe koribo..
sir can we use this program?
n=int(input("Enter a number"))
x=str(n)
sum=0
for i in x:
y=int(i)
sum+=y
print("Sum of digits of",n,'=',sum)
instead of putting n=(int(....)) and then converting it to string. You can directly get input in for of string. No need for conversion.
@@danishhasan7123 ya best way__take input as a sting
i=int(input('enter value'))
sum=0
while i>0:
sum=sum+i%10
i=int(i/10) #i=i//10
print('sum',sum)
Thanku sir, really good explanation
You're most welcome !
Sir iss program ka kuchh alternate tarikka hain ???
This is the easiest one Ashish !
sum=2+4+8
print(sum)
Tnq u
Thanks sir ❤️❤️
Most welcome Abhinav!
Bhiya iss program me Thora confused hu....
Sum =sum+i%10
Is it mandatory Ki hum %10 se hi kre.... %20 se Nhi kr skte?
i%10 gives us last digit.
Sir thanks
Welcome!
Sir , why we choose always 10 value after modulus please explain, can we write another value just like 15, 20 etc.
Because we are extracting the frace value of each of the digits at 10s place, 100s place, 1000s place etc, which is possible by dividing the number only with 10.
Sir agar Negative numbers k Digits kaa sum karna ho toh???? 🙂
Bus usme ek - sign add kardo print wali statement mai
can u please make a video of these by using for loop
thank you sir
Welcome Varsha 🙂
If int is 201 then condition gone wrong in while loop 🙄
What to do for that case?
Nope, I think you're confused in i//10, as after 1 the n will become 20 which gives the condition r = 2 .. And when you sum the digit we got 3 in this case the program will be done only in 2 steps .. I think I'm bad in explaining lol
Thank you sir.
Most welcome🙂
Thanks bhai
Thanks Shubham !
sum=0
num=int(input("enter the number: "))
while(num!=0):
temp=num%10
sum=sum+int(temp)
num=num/10
print("sum of the digits is:",sum)
🤔🤔🤔
sum=2+4+8
print(sum)
⬆️This is a easy way to find sum of digit of a number. 😎😎
I know you are joking but we are actually taking input from user.
Super
😊
Damn explanation!!
why we took % 10 sir, please explain i didn't understand
Thankyou!!!!!!!
Most welcome Himani!
Sir maine ye hi coding kari but
Maine agar 344 dala to
Output araaha hai
Sum is 4
Sum is 8
Sum is 11
3 step aarahe hai
same here,please tell how you resolve that issue
Bhai print statement ko loop se bahr nikaldo space clear krke
@@gamingzone-zi6ty thanks bro!! but i already resolve that
Sir, How much important this program..? Just because I want to skip this
Ye program using recursion function kaise banega .....
def sum_of_digit( n ):
if n == 0:
return 0
return (n % 10 + sum_of_digit(int(n / 10)))
num = int(input("Enter Number:"))
result = sum_of_digit(num)
print("Sum of digits in",num,"is", result)
@@codeitup Thanks.....isme if n==0 hoga ya if n< 10 hoga
Ya dono sahi h sir
Superrr
Thanks Saji!
Sir app bahut achha padhate hai...but I forget in exam...what to do
Practice sirji
can anyone explain why this is not working for 999
n=int(input("Enter a number"));
Sum=0;
while(n>0):
rem=n%10;
Sum=Sum+rem;
n=n//10;
print(Sum);
Is working for 999
The trick given by anand sir is working for 999 i got 27
It's working bro
Sir can you tell another method to do this program please tell sir🙏
thank yous sir!!
Most welcome!🙂
Great video content sir!
☺️
Txxxx
🙂
Sir sum =0 compulsory h kya
Hnji bilkul !
Tho fir singke digit aaney keliye kasia karna hain
sir next video ka link de diya kariye please
Tutorial series step by step hi hai.
done
if i given input 13 it is showing output as 3 and 4 y
Print sum after the loop closes.
how to print the sum for this string (1time3 %times4) 1+3+4=8
multiplication =1
multiplication =multiplication *i%70
ऐसा कर सकते हैं क्या multiplication करणे के लिये
Any other way to solve this?
Statement may be written in different ways but the concept will be same Tanmay.🙂
@@codeitup alright.
sir isme humne (i>=0): kyu nhi liya?
Because it will give us the same result.that's why we simply used (i>0)
@@AbhinavSharma-ff9mo thnx bruh
Sir, this program can be done using for loop? Cause I made a program to do it.
here is the code :
# wap to add square of digit of a given number
n=int(input("Enter the Number : "))
i=0
sum=0
for i in range(1,n):
sum=sum+(n%10)**2
n=n//10
print(sum)
please reply, if there is any error
Why did we take 10 int in program??
We can take any number not only 10. Its just the concept.
Tanks sir but sir mere pass pc ya laptop nahi he to me kese program kro
You can use qpython app for running python app..
@@codeitup sir naam btana app ka
Aise print krna ho to
4625
4+6+2+5 =17
1+7 =8
Bro if i give input in your code like 123
Output like
3
5
6
But why?
sir why is %10 used??
To get the last digit Aditi !!!
carryminati
technical guruji
bb ki vines
yaar ye tags kyu use kar rahe ho?
Sir = kyo nhi dala while me
If i>=0,then
Then there will be two cases to consider
i>0
and i=0
If i=0, then i=sum[since, sum =0]
which means the loop will not repeat and therefore the program will remain unexecuted
sir sum=sum +i%10
yha 10 kyu liya aapne
Kyoki 10 se divide karke remainder haesha last digit aata hai..
@@codeitup got it sir
how to take multiple inputs like
Input Format
=================>
Input : 3 12345 31203 2123
Constraints
Constraints - 1 ≤ T ≤ 1000 1 ≤ N ≤ 1000000
Output Format
Output : 15 9 8
Thanks sir 🤗
Always welcome😊