"🔥Caltech Post Graduate Program In AI And Machine Learning - www.simplilearn.com/artificial-intelligence-masters-program-training-course?H5OneJb-U&Comments&TH-cam 🔥IITK - Professional Certificate Course in Generative AI and Machine Learning (India Only) - www.simplilearn.com/iitk-professional-certificate-course-ai-machine-learning?H5OneJb-U&Comments&TH-cam 🔥Purdue - Post Graduate Program in AI and Machine Learning - www.simplilearn.com/pgp-ai-machine-learning-certification-training-course?H5OneJb-U&Comments&TH-cam 🔥IITG - Professional Certificate Program in Generative AI and Machine Learning (India Only) - www.simplilearn.com/iitg-generative-ai-machine-learning-program?H5OneJb-U&Comments&TH-cam 🔥Caltech - AI & Machine Learning Bootcamp (US Only) - www.simplilearn.com/ai-machine-learning-bootcamp?H5OneJb-U&Comments&TH-cam"
Float - It represents real numbers like 3.14159 or -2.5 String - Text which is denoted by single or double quotes Integer -It represents positive or negative whole numbers like 3 or -512
Hi Steve, thanks for replying. We have made a small correction in the code. The mistake is if you are assigning a new value to c, then that means you haven't swapped the values. Check the corrected code below: a = 100 b = 200 print(a, b) c = b b = a a = c print(a, b)
Hi Bharath, you found the right answer. Kudos! Do show your love by subscribing our channel using this link: th-cam.com/users/Simplilearn and don't forget to hit the like button as well. Cheers!
Python recognizes this as a string. because it only stores one value inside it. If you want to turn it into Tuple type, you should type it this way: ("g",)
"🔥Caltech Post Graduate Program In AI And Machine Learning - www.simplilearn.com/artificial-intelligence-masters-program-training-course?H5OneJb-U&Comments&TH-cam
🔥IITK - Professional Certificate Course in Generative AI and Machine Learning (India Only) - www.simplilearn.com/iitk-professional-certificate-course-ai-machine-learning?H5OneJb-U&Comments&TH-cam
🔥Purdue - Post Graduate Program in AI and Machine Learning - www.simplilearn.com/pgp-ai-machine-learning-certification-training-course?H5OneJb-U&Comments&TH-cam
🔥IITG - Professional Certificate Program in Generative AI and Machine Learning (India Only) - www.simplilearn.com/iitg-generative-ai-machine-learning-program?H5OneJb-U&Comments&TH-cam
🔥Caltech - AI & Machine Learning Bootcamp (US Only) - www.simplilearn.com/ai-machine-learning-bootcamp?H5OneJb-U&Comments&TH-cam"
1. x,y = 5,10
2. x,y = y,x
3. print (x)
4. print (y)
# result will be 10,5
Hi Nawaz, this code is perfect and correct!. Kudos!
a=100
b=200
print("before swap",a,b)
temp=a
temp2=b
b=temp
a=temp2
print("after swap",a,b)
Hi Rishabh, you got the right answer! Kudos!
A=100
B=200
Print("before swap" A, B)
A=A+B
B=A-B
A=A-B
Print("after swap" A, B)
Wow! you got the answer right. Kudos!
a,b=100,200
a,b=b,a
print("This A value",a)
print("This B value",b)
Ans:
This A value 200
This B value 100
Thanks for watching our video and sharing your thoughts. Do subscribe to our channel and stay tuned for more. Cheers!
a = 100
b = 200
a,b = b,a
print(a,b)
To make a quick swap:)
Wow! you got the answer right. Kudos!
x=100
y=200
print('before swap',x,y)
temp=x
x=y
y=temp
print('after swap',x,y)
Wow! you got the right answer! kudos! Do check out our other tutorial videos and subscribe to us to stay connected. Cheers :)
x,y=1,2
x,y=y,x
Print(x,y)
Using third variable
Temp=x
X=y
Y=Temp
Without using third variable
X=X*y
Y=x-y
X=x_-y
Bro pls can u send me exact definetions for float string integer...
Float - It represents real numbers like 3.14159 or -2.5
String - Text which is denoted by single or double quotes
Integer -It represents positive or negative whole numbers like 3 or -512
Before swapping
A=100
B=200
After swapping
A,B=200,100
Hi Santosh, this code is perfect and correct!. Kudos!
a=100
b=100
(b,a)=(a,b)
print(a,b)
Wow! you got the answer right. Kudos!
a = 100
b = 200
print(a, b)
c = 200
b = a
a = c
print(a, b)
Hi Steve, thanks for replying. We have made a small correction in the code. The mistake is if you are assigning a new value to c, then that means you haven't swapped the values. Check the corrected code below:
a = 100
b = 200
print(a, b)
c = b
b = a
a = c
print(a, b)
A,B= (b,a)
Print(A,B)
It's wrong. You need to swap the values of the variables not create new variables. Hope that helps!
a=100
b=200
a,b=b,a
print(a,b)
Wow! you got the answer right. Kudos!
A=100
B=100
A,B = B,A
Print (A)
Print (B)
Hi Bharath, you found the right answer. Kudos!
Do show your love by subscribing our channel using this link: th-cam.com/users/Simplilearn and don't forget to hit the like button as well. Cheers!
why do not use pycharm
M=("g")..it's showing string not tuple why
Python recognizes this as a string. because it only stores one value inside it. If you want to turn it into Tuple type, you should type it this way: ("g",)
A=100
B=200
C=A
A=B
B=C
Wow! you got the answer right. Kudos!
A=100
B=200
C=A
B=C
print(B)
Sorry, wrong answer! In this process, you have lost the original value of B.The right answer is below:
a=100
b=200
c=a
a=b
b=a
a=100
b=200
c=a
b=c
c=b
a=c
Wow! you got the answer right. Kudos!
Initially, A holds 100, B holds 200. To swap values, in Python a simple code would be A,B=200,100. Now A would hold 200 and B, 100
>>> a,b=100,500
>>> a,b=b,a
>>> print(a,b)
500 100
>>>
That's right as well.