Great real life example and it worked. Of course there might be efficient ways to write this but this is what I first thought... a=input("enter value of a ") b=input("enter value of b ") c=a a=b b=c print("a is " +a) print("b is " +b)
you can't use this because the question is to swap the value which means the value of "a" should swap to "b" and the value of "b" should swap to "a" at the end when you print the variable "a" it should print the value of "b" it's not about showing the value the question is about to change the value from one variable to another vice-versa I hope this comment will help you, but it's been 11 months you commented to this video but i replayed now hope you understand this.
Another method for swapping is a = int(input("Enter number a: ")) b = int(input("Enter number b: ")) a = a+b b = a - b a = a - b # Use f-String to print this print(f"a = {a} b = {b}")
a=float(input("Enter value of a: ")) b=int(input("Enter value of b: ")) c=a #c==a a==a b==b a=b #c==a a==b b==b b=c print(f"a = {a}") print(f"b = {b}") What's interesting is that it changes types too, a is now int type and b is now float type and says 10.0
a = input("Enter the value of a: ") b = input("Enter the value of b: ") # Display initial values print("The initial value of a =", a) print("The initial value of b =", b) # Swap the values using a temporary variable temp = a a = b b = temp # Display swapped values print("The swapped value of a =", a) print("The swapped value of b =", b)
I love it, you made great job. Your explanation so simple and amazing same time! Thank you very much, Jenny! Also I like when you draw examples and show everyhing how it works!😍
जीवन में कठिनाइयां हमें बर्बाद करने नहीं आती है, बल्कि यह हमारी छुपी हुई सामथ्र्य और शक्तियों को बाहर निकालने में हमारी मदद करती हैं कठिनाइयों को यह जान लेने दो की आप उससे भी ज्यादा कठिन हो।... 👍🏻👍🏻
a = input("Enter the value of a: ") b = input("Enter the value of b: ") print(a,b) c = a # c = 1 print(a, b, c) a = b # a = 2 print(a,b,c) b = c # b = 1 print(a,b,c) # basically we take another container c which is empty. # 1. c mein a wali value store krdi that is (1) # 2. a mein b wali value store krdi that is (2) # 3. b mein c wali value store krdi which was basically a ki value that is (1) # summary: aik khali container c liya, us mein a ki value daal di jis se a ki value a main aue c main dono main hogyi, # phir a main b ki value daal di jis se b ki value swap hogyi, # at the end b main c ki value daal di which was basically a ki value jis se a ki value swap hogyi print(a) print(b) Enter the value of a: 1 Enter the value of b: 2 1 2 1 2 1 2 2 1 2 1 1 2 1
a = input("Enter a value a: ") b = input("Enter a value b: ") temp = " " print("before: ") print( a + "," + b) temp = a a = b b = temp print("After: ") print( a + "," + b)
hi, please go through the question and understand properly, You can't use this when an interviewer asked the question because the question is to swap the value which means the value of "a" should swap to "b" and the value of "b" should swap to "a" at the end when you print the variable "a" it should print the value of "b" it's not about showing the value the question is about to change the value from one variable to another vice-versa I hope this comment will help you.
Hello mam I have a question that We can do swaping like this but this is not swaping but like swap A=input("enter value of a=") B=input("enter value of b=") Print("a=",B "b=",A)
Ma'am ,I think, I can use the code like this, can't I....? Input("enter value of a=") Input("enter value of b=") Print("a=" , b ) Print("b=" , a ) Ma'am am I right or wrong???
#swaping num_1=int(input("Enter number 1 : ")) num_2=int(input("Enter number 2 : ")) num_1,num_2=num_2,num_1 print("Number 1 is ",num_1) print("Number 2 is ",num_2)
ma'am, you have said that by default input will take any values as a string,but if use interger (int) function before the input,we cannot need to concatate (+) function,right. and did you get my point??
everything is understandable easily with help of tea & milk example. and also program is very simple to understand. but i have one query on Concatenates e.g. "coma(,), plus(+),etc.. i didn't understand why we are using (+) or (,) for this swap thing? can you please torch on that point?
U have to interchange those variables value .. not a places in console bro... Whenever u print (a) . U must be get the (b) value in console and vice versa.. that's interchange/swapping concept
The way you are explaining with real life examples is very good🥳
Your classes are excellent🎉
One of the best lecturer!
the example of how to interchange tea and coffee is perfect and unforgettable. great way of teaching
U are really good teacher ma
The real life example you gave immediately gave me a clear understanding of the swappingg
Great real life example and it worked. Of course there might be efficient ways to write this but this is what I first thought...
a=input("enter value of a ")
b=input("enter value of b ")
c=a
a=b
b=c
print("a is " +a)
print("b is " +b)
Another way to swap numbers
a = input("a = ")
b = input("b = ")
a,b =b,a
print("a = "+a)
print("b = "+b)
It's working
a=input(print("Enter value for a: "));
b=input(print("Enter value for b: "));
print("Value of a: ",b);
print("Value of b: ",a);
you can't use this
because the question is to swap the value which means the value of "a" should swap to "b" and the value of "b" should swap to "a"
at the end when you print the variable "a" it should print the value of "b"
it's not about showing the value the question is about to change the value from one variable to another vice-versa
I hope this comment will help you, but it's been 11 months you commented to this video but i replayed now hope you understand this.
Aap teaching krte krte bich me smile krte ho ,to hmare face par bhi smile ata hai😂
🙂🤗🤗
a=input("Enter Value of a = ")
b=input ("Enter Value of b =")
print ("a = " + b)
print ("b = " + a)
a = input("Enter the first number...")
b = input("Enter the second number...")
# swapping the value
temp = a
a = b
b = temp
print(a)
print(b)
It's not correct
@@crazyeditzz2437 please tell me where am wrong
@@devSackey I tried print(a) and print(b) then in python it shows only a & b but not the values like a=2 and b =3 I hope u understand
@@crazyeditzz2437 i understand but i also tried it here and it showed me the value of a and b as required
@@devSackey yeah it's working good job🥰 but we should get it as a=some number and b= some number it should indicate
Another method for swapping is
a = int(input("Enter number a: "))
b = int(input("Enter number b: "))
a = a+b
b = a - b
a = a - b
# Use f-String to print this
print(f"a = {a}
b = {b}")
Amazing jenny ..
First program i can do it with my self with complete logic
Thanks
Wow!You have exemplified all concepts really well.
I listened to your lectures man for my python final exams I passed tysm mam
Thank you for honest teaching 🙏
Thanks your teaching very interest, I actually like your eyes also it's beautiful.
*itni sundar maam 😍😍mujhe btech me milti to me Abhi Coding expert ban chhuka hota!* 😰
a,b=1,2
a,b=b,a
print("after updation a= "+str(a))
print("after updation b= "+str(b))
a=float(input("Enter value of a: "))
b=int(input("Enter value of b: "))
c=a #c==a a==a b==b
a=b #c==a a==b b==b
b=c
print(f"a = {a}")
print(f"b = {b}")
What's interesting is that it changes types too, a is now int type and b is now float type and says 10.0
why f is required in the print statement at last what does it mean bro?
a = input("enter value of a = ")
b = input("enter value of b = ")
a,b = b,a
print("a = " + a)
print("b = " + b)
a = input("Enter the value of a: ")
b = input("Enter the value of b: ")
# Display initial values
print("The initial value of a =", a)
print("The initial value of b =", b)
# Swap the values using a temporary variable
temp = a
a = b
b = temp
# Display swapped values
print("The swapped value of a =", a)
print("The swapped value of b =", b)
@@muhsinbinirshad but did it provide syntax error
7:05 thank you madam, love your teachings
I love it, you made great job. Your explanation so simple and amazing same time! Thank you very much, Jenny! Also I like when you draw examples and show everyhing how it works!😍
#swap 2 numbers
a = 20
b = 30
c=b
b=a
a=c
print(a,b)
जीवन में कठिनाइयां हमें बर्बाद करने नहीं आती है, बल्कि यह हमारी छुपी हुई सामथ्र्य और शक्तियों को बाहर निकालने में हमारी मदद करती हैं कठिनाइयों को यह जान लेने दो की आप उससे भी ज्यादा कठिन हो।... 👍🏻👍🏻
Fast content delivery is important to relay on it. When exams are over then what you are uploading daily its good
The tutorial is so easy to follow and understand.
a= 1
b=2
a,b = b,a
print(a,b)
Ya that's also works and easy too
Best channel i ever saw❤❤
Great teaching style, thank you for sharing your knowledge
a = input("Input your first number: ")
b = input("Input your second number: ")
swap = a
a = b
b = swap
print("
a = " + a + "
b = " + b)
Okie...
yup, got it. I did have an unexpected output because I put a space in my code line but when I removed it i got the same result as you
a = input("Enter the value of a: ")
b = input("Enter the value of b: ")
print(a,b)
c = a # c = 1
print(a, b, c)
a = b # a = 2
print(a,b,c)
b = c # b = 1
print(a,b,c)
# basically we take another container c which is empty.
# 1. c mein a wali value store krdi that is (1)
# 2. a mein b wali value store krdi that is (2)
# 3. b mein c wali value store krdi which was basically a ki value that is (1)
# summary: aik khali container c liya, us mein a ki value daal di jis se a ki value a main aue c main dono main hogyi,
# phir a main b ki value daal di jis se b ki value swap hogyi,
# at the end b main c ki value daal di which was basically a ki value jis se a ki value swap hogyi
print(a)
print(b)
Enter the value of a: 1
Enter the value of b: 2
1 2
1 2 1
2 2 1
2 1 1
2
1
a = input("Enter a value a: ")
b = input("Enter a value b: ")
temp = " "
print("before:
")
print( a + "," + b)
temp = a
a = b
b = temp
print("After:
")
print( a + "," + b)
a = 11
b = 7
temp = a
a = b
b = temp
print(a)#7
print(b)#11
output
7
11
Process finished with exit code 0
Glasses are cool ! Jenny madam
val1 = input("enter the value of A = ")
val2 = input("enter the value of B = ")
print("A = " +val2)
print("B = " +val1)
hi, please go through the question and understand properly, You can't use this when an interviewer asked the question
because the question is to swap the value which means the value of "a" should swap to "b" and the value of "b" should swap to "a"
at the end when you print the variable "a" it should print the value of "b"
it's not about showing the value the question is about to change the value from one variable to another vice-versa
I hope this comment will help you.
You are inspiration mam ❤️💕💕💕
Thank you so much. I find your tutorials much easier to understand. I hope to continue learning this python programming
Ans of que at 5:10 input() is return string so we concate in print("a=" + a)
we can concatinate the integer also because the input function every value it taken as string
another way:
a=int(input("Enter value of a="))
b=int(input("Enter value of b="))
num_1=b
num_2=a
print(f"a={num_1}
b={num_2}.")
Thank you so much mam for next level of teaching
we can do this also ??
x = input("Enter a number a:" )
y = input("Enter a number b: ")
print("a =", y)
print("b = ", x)
@@tanishshriyan-ho2yt no.
Nice looking ma'am and good teaching style, i love you ma'am 🙏🏻❤️🙏🏻🙏🏻
num1 = input ("value of a")
num2 = input ("value of b")
num1 = num2
num2 = num1
Print ("num1
num2")
Sry print num4 and 5
Mam you look good without glasses.... 😊😊
thank you ma'am great explanation🙂
Thanks mam god bless you 🙏
a=input("enter the value of a:")
b=input("enter the value of b:")
print("a="+b)
print("b="+a)
We can use this right
Understood.
a=int(input("Enter First Number"))
b=int(input("Enter Second Number"))
print("two numbers are:
")
print(a,b)
c=a
d=b
b=c
a=d
print("swaped numbers are:
")
print(a,b)
Use only one extra variable to swap
@@JennyslecturesCSIT
done..Im sorry for late reply
a = input("a: ")
b = input("b: ")
c=a
a=b
b=c
print("a: " + a)
print("b: " + b)
may be this is easier try this
a=10
b=12
a,b=b,a
print(a)
print(b)
very nice tutorials
Thank You So
Much
A,B = B,A
a=input ()
b=input ()
Print("a = " +b)
Print("b = " + a)
Out_put:
a = 2
b = 1
In_put:
1
2
Is it right?
a=input("your value a:-")
b=input("Your value b:-")
print("a=" + b)
print("b=" + a)
it is simple why use temp?
You are Good
Thanks mam making for this course
Nice specs u look different but still look like my Mercury ❤️
Thank you so much mam❣️
b=input("enter value of a ")
a=input("enter value of b ")
print("b= "+b)
print("a= "+ a)
please reply tell me if did anything wrong here
Superb🎉🎉🎉🎉
Hello mam....can you tell me some important questions of c of chapter (arrays,pointers,strings, structures, file handling in c ) bca exams
Simply write
a,b=b,a
apologize due to work I missed 1 2 lecture thanks a million.
queen of code ❤️❤️
I love mam ❤️❤️❤️
Thank you so much mam🙏🙏🙂
Hello mam I have a question that
We can do swaping like this but this is not swaping but like swap
A=input("enter value of a=")
B=input("enter value of b=")
Print("a=",B
"b=",A)
use f-string for this
@@santhoshk2722 Could you please rewrite it in f string function?
b=input("enter the value of a=")
a=input("enter the value of b=")
print("a=" +a)
print("b=" +b)
is it correct mam?
Chashma mei achhi lag rahi mam. Superb
Todays exercise -
a=input("X= ")
b=input("Y= ")
c=a
a=b
b=c
print("X= "+a)
print("Y= "+b)
a=input("enter value of a=")
b=input("enter value of b=")
a=b
b=a
print("a=2")
print("b=1")
Is it right or wrong?
thank you mam
❤ Awesome!!!!!!!!!!!!!!!!!
Ma'am ,I think, I can use the code like this, can't I....?
Input("enter value of a=")
Input("enter value of b=")
Print("a=" , b )
Print("b=" , a )
Ma'am am I right or wrong???
Thank you for this lecture mam 🙏
Temporary container
I like ur real life examples mam 😂
#swaping
num_1=int(input("Enter number 1 : "))
num_2=int(input("Enter number 2 : "))
num_1,num_2=num_2,num_1
print("Number 1 is ",num_1)
print("Number 2 is ",num_2)
ma'am, you have said that by default input will take any values as a string,but if use interger (int) function before the input,we cannot need to concatate (+) function,right. and did you get my point??
Mam ek simple aap our website ki kuch coding karke kisi koi opreting model me install ka koi video banayena
Mam the value in input is string by default and the string in the print can concatenate
I did it this way
A=input("enter value of a")
B=input("enter value of b")
Temp="a"
a="b"
b="temp"
The result was the same thing. The value swapped.
Can you make a video with topics like escape,traverse,
everything is understandable easily with help of tea & milk example. and also program is very simple to understand. but i have one query on Concatenates e.g. "coma(,), plus(+),etc.. i didn't understand why we are using (+) or (,) for this swap thing? can you please torch on that point?
Just watched 8th lecture again and i got my answer that it is print(string & integer) e.g. print("a=" +/, a) ✔️ 🤩
Mam your explanation is well but,we want some more examples
i got the answer 2=1
Thank you so much mam for this course 😊
Mam simply I was,
a=input("enter value of a")
b=input("enter value of b")
Print(b)
Print(a)
And I got it , is it right??
i tried this but saw that, when i placed two papers in my palm, i could only swap putting one down to empty another...
U have to interchange those variables value .. not a places in console bro... Whenever u print (a) . U must be get the (b) value in console and vice versa.. that's interchange/swapping concept
a, b=10, 20
print("a:%d b:%d" %(a, b))
a, b = b, a
print("a:%d b:%d" %(a, b))
-------------------------------------
output:
a:20 b:30
a:30 b:20
a=input("enter value of a ")
b=input("enter value of b ")
c=a
a=b
b=c
print("a= "+ a)
print("b= "+ b)
how to store two numbers in two different variable using one input statement
for eg -
if I say -
Enter two numbers
str to int
Thank you for this course 😊 mem
Why should u use +a we can use print("a=" a)
a,b=b,a
Mam please remove your specs, we get distracted from it!!!!
But I really likes your videos and content:)
First I thought you could just swob a and b at the same time.
am a little bit confused in the swapping logic.