P_09 Coding Exercises for Beginners in Python | Exercise #2 | Program to swap two numbers

Поделиться
HTML-код
  • Опубликовано: 27 янв 2025

Комментарии • 220

  • @srikaryenugula
    @srikaryenugula Год назад +20

    The way you are explaining with real life examples is very good🥳
    Your classes are excellent🎉
    One of the best lecturer!

  • @achugh52
    @achugh52 4 месяца назад +4

    the example of how to interchange tea and coffee is perfect and unforgettable. great way of teaching

  • @wisdomkekang896
    @wisdomkekang896 Год назад +8

    U are really good teacher ma
    The real life example you gave immediately gave me a clear understanding of the swappingg

  • @Aditya-ko2ys
    @Aditya-ko2ys Месяц назад +1

    really appreciate the way you teach mam thank you so much now im starting to gain interest in python language

  • @acharyaguy
    @acharyaguy 2 года назад +16

    a=input(print("Enter value for a: "));
    b=input(print("Enter value for b: "));
    print("Value of a: ",b);
    print("Value of b: ",a);

    • @Lildev19
      @Lildev19 Год назад +5

      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.

    • @bittu6724
      @bittu6724 25 дней назад

      a=input("Enter value for a: ")
      b=input("Enter value for b: ")
      print("Value of a: ",b)
      print("Value of b: ",a)

  • @SsgulRajhani
    @SsgulRajhani Год назад +1

    Amazing jenny ..
    First program i can do it with my self with complete logic
    Thanks

  • @itsmylife4048
    @itsmylife4048 3 месяца назад

    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)

  • @saipukale8457
    @saipukale8457 Год назад +11

    Another way to swap numbers
    a = input("a = ")
    b = input("b = ")
    a,b =b,a
    print("a = "+a)
    print("b = "+b)

  • @chamara854
    @chamara854 Год назад +2

    Thanks your teaching very interest, I actually like your eyes also it's beautiful.

  • @tinklingclaps2499
    @tinklingclaps2499 3 месяца назад

    Wow!You have exemplified all concepts really well.

  • @awmrudraaksh4184
    @awmrudraaksh4184 Месяц назад

    Hello ma'am, really enjoying learning from your lectures. Actually i'm a Delhi University student pursuing an arts course. I took python as a minor. Didn't have intrest at all in the beginning because i was not able to understand anything what my teacher taught which made the subject for me "boring". But after watching your python lectures, the kind of easy explanation that you give makes the subject really interesting and learning from your videos is really worth it. I just want to thank you that because of you, I've developed keen intrest in this subject.. Now loving this subject sooooo much!!!!! Thank you ma'am.

  • @pratapsatyam
    @pratapsatyam 2 года назад +5

    Thank you for honest teaching 🙏

  • @Kingkong_1013
    @Kingkong_1013 6 месяцев назад +2

    Aap teaching krte krte bich me smile krte ho ,to hmare face par bhi smile ata hai😂

  • @lilliana_es
    @lilliana_es 11 месяцев назад

    7:05 thank you madam, love your teachings

  • @swarpranalimusic6651
    @swarpranalimusic6651 2 года назад +3

    a=input("Enter Value of a = ")
    b=input ("Enter Value of b =")
    print ("a = " + b)
    print ("b = " + a)

  • @devSackey
    @devSackey Год назад +17

    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)

    • @crazyeditzz2437
      @crazyeditzz2437 7 месяцев назад

      It's not correct

    • @devSackey
      @devSackey 7 месяцев назад

      @@crazyeditzz2437 please tell me where am wrong

    • @crazyeditzz2437
      @crazyeditzz2437 7 месяцев назад

      @@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

    • @devSackey
      @devSackey 7 месяцев назад +1

      @@crazyeditzz2437 i understand but i also tried it here and it showed me the value of a and b as required

    • @crazyeditzz2437
      @crazyeditzz2437 7 месяцев назад

      @@devSackey yeah it's working good job🥰 but we should get it as a=some number and b= some number it should indicate

  • @Aristokrat92
    @Aristokrat92 8 месяцев назад

    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!😍

  • @fbushphone
    @fbushphone 9 месяцев назад

    Great teaching style, thank you for sharing your knowledge

  • @ONLINESTUDYHELPER
    @ONLINESTUDYHELPER 2 года назад

    Best channel i ever saw❤❤

  • @santhoshk2722
    @santhoshk2722 Год назад +7

    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}")

  • @randomhuman5208
    @randomhuman5208 6 месяцев назад

    I listened to your lectures man for my python final exams I passed tysm mam

  • @TheOdiaTrader
    @TheOdiaTrader 2 года назад +1

    *itni sundar maam 😍😍mujhe btech me milti to me Abhi Coding expert ban chhuka hota!* 😰

  • @praveenvaddadi194
    @praveenvaddadi194 2 года назад +1

    Glasses are cool ! Jenny madam

  • @sajanbrother
    @sajanbrother 2 года назад

    Nice looking ma'am and good teaching style, i love you ma'am 🙏🏻❤️🙏🏻🙏🏻

  • @afshannamreen5214
    @afshannamreen5214 8 месяцев назад

    thank you ma'am great explanation🙂

  • @ThandaraDigital
    @ThandaraDigital Год назад +1

    The tutorial is so easy to follow and understand.

  • @sagaswami2668
    @sagaswami2668 Год назад

    Thank you so much mam for next level of teaching

  • @lokeshraybarman7007
    @lokeshraybarman7007 2 года назад

    You are inspiration mam ❤️💕💕💕

  • @limitess9539
    @limitess9539 Год назад +1

    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

    • @Rishithabajjuri
      @Rishithabajjuri Год назад

      why f is required in the print statement at last what does it mean bro?

  • @murungicalvin5235
    @murungicalvin5235 Год назад +2

    Thank you so much. I find your tutorials much easier to understand. I hope to continue learning this python programming

  • @vasubhalani1636
    @vasubhalani1636 Год назад

    Ans of que at 5:10 input() is return string so we concate in print("a=" + a)

  • @surinder7765
    @surinder7765 2 года назад

    Thanks mam god bless you 🙏

  • @abhishekdubey9920
    @abhishekdubey9920 2 года назад

    Fast content delivery is important to relay on it. When exams are over then what you are uploading daily its good

  • @harshaharsha6681
    @harshaharsha6681 Год назад

    Superb🎉🎉🎉🎉

  • @MeenakshiAchutha
    @MeenakshiAchutha 6 месяцев назад

    we can concatinate the integer also because the input function every value it taken as string

  • @nehamaurya27
    @nehamaurya27 2 года назад

    Mam you look good without glasses.... 😊😊

  • @micmike
    @micmike 2 года назад

    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

  • @harishkmurali3757
    @harishkmurali3757 2 года назад

    Thank you so much mam❣️

  • @muhsinbinirshad
    @muhsinbinirshad 9 месяцев назад +1

    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)

  • @yashaggarwal6013
    @yashaggarwal6013 2 года назад

    a = input("enter value of a = ")
    b = input("enter value of b = ")
    a,b = b,a
    print("a = " + a)
    print("b = " + b)

  • @glps369
    @glps369 Год назад

    Thank You So
    Much

  • @ZainNazeer-wf2gi
    @ZainNazeer-wf2gi 2 года назад

    very nice tutorials

  • @pragathi068
    @pragathi068 2 года назад +5

    a,b=1,2
    a,b=b,a
    print("after updation a= "+str(a))
    print("after updation b= "+str(b))

  • @Arayankodesouth
    @Arayankodesouth 2 года назад

    ❤ Awesome!!!!!!!!!!!!!!!!!

  • @umershahzad8504
    @umershahzad8504 2 года назад

    Thanks mam making for this course

  • @FunplosionHQ
    @FunplosionHQ 2 года назад +2

    a= 1
    b=2
    a,b = b,a
    print(a,b)

  • @_yes_you_are_right_214
    @_yes_you_are_right_214 2 года назад +1

    Okie...

  • @parth7221
    @parth7221 2 года назад

    Nice specs u look different but still look like my Mercury ❤️

  • @priya-we2hg
    @priya-we2hg 2 года назад +3

    जीवन में कठिनाइयां हमें बर्बाद करने नहीं आती है, बल्कि यह हमारी छुपी हुई सामथ्र्य और शक्तियों को बाहर निकालने में हमारी मदद करती हैं कठिनाइयों को यह जान लेने दो की आप उससे भी ज्यादा कठिन हो।... 👍🏻👍🏻

  • @tanishshriyan-ho2yt
    @tanishshriyan-ho2yt 8 месяцев назад +2

    we can do this also ??
    x = input("Enter a number a:" )
    y = input("Enter a number b: ")
    print("a =", y)
    print("b = ", x)

  • @BrainyQuizZone
    @BrainyQuizZone 2 года назад

    Thank you so much mam🙏🙏🙂

  • @pavanamballa255
    @pavanamballa255 2 года назад +1

    I love mam ❤️❤️❤️

  • @pushpindersharma4880
    @pushpindersharma4880 Год назад

    You are Good

  • @yoyogameryt1418
    @yoyogameryt1418 2 года назад +5

    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)

    • @santhoshk2722
      @santhoshk2722 Год назад

      use f-string for this

    • @muqeethurrahaman
      @muqeethurrahaman 9 месяцев назад

      @@santhoshk2722 Could you please rewrite it in f string function?

  • @a.sirishareddy6908
    @a.sirishareddy6908 Год назад

    Mam the value in input is string by default and the string in the print can concatenate

  • @jagadeeshkj5561
    @jagadeeshkj5561 2 года назад +1

    Understood.

  • @thecloudterminal
    @thecloudterminal 2 года назад

    Thank you for this lecture mam 🙏

  • @SanjoyKumarMondol-go1vo
    @SanjoyKumarMondol-go1vo 13 дней назад

    # Prompt user to enter the value of a
    a = float(input("Enter the value of a: "))
    # Prompt user to enter the value of b
    b = float(input("Enter the value of b: "))
    # Display the original values
    print("Before swapping:")
    print("a =", a)
    print("b =", b)
    # Swap the values
    a, b = b, a
    # Display the swapped values
    print("After swapping:")
    print("a =", a)
    print("b =", b)

  • @man07imperfext
    @man07imperfext 7 месяцев назад

    a = input("Input your first number: ")
    b = input("Input your second number: ")
    swap = a
    a = b
    b = swap
    print("
    a = " + a + "
    b = " + b)

  • @khushityagi5930
    @khushityagi5930 2 года назад +9

    Hello mam....can you tell me some important questions of c of chapter (arrays,pointers,strings, structures, file handling in c ) bca exams

  • @AmazingCreationsStudio
    @AmazingCreationsStudio Год назад

    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)

  • @sajjadali-nj1wh
    @sajjadali-nj1wh 28 дней назад

    Input always takes string value so, the value of 'a' and 'b' is string here.

  • @LingeshhvarenKA
    @LingeshhvarenKA 24 дня назад

    num1 = input("Enter number 1 : ")
    num2 = input("Enter number 2 : ")
    temp = num1
    num1 = num2
    num2 = temp
    print("Value of number 1 is",num1,"Value of number 2 is",num2)

  • @abdulhannan.018
    @abdulhannan.018 Год назад

    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

  • @TimesUp24
    @TimesUp24 Год назад

    val1 = input("enter the value of A = ")
    val2 = input("enter the value of B = ")
    print("A = " +val2)
    print("B = " +val1)

    • @Lildev19
      @Lildev19 Год назад

      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.

  • @Advanceauto999
    @Advanceauto999 Год назад

    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

  • @venkatgunda7182
    @venkatgunda7182 11 месяцев назад

    #swap 2 numbers
    a = 20
    b = 30
    c=b
    b=a
    a=c
    print(a,b)

  • @mnmelodious9411
    @mnmelodious9411 2 года назад

    apologize due to work I missed 1 2 lecture thanks a million.
    queen of code ❤️❤️

  • @-SakuraNoHana-
    @-SakuraNoHana- Год назад

    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}.")

  • @eswarkorada1954
    @eswarkorada1954 2 года назад

    thank you mam

  • @techiebd_plyr_wb6246
    @techiebd_plyr_wb6246 2 года назад

    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)

    • @JennyslecturesCSIT
      @JennyslecturesCSIT  2 года назад +2

      Use only one extra variable to swap

    • @techiebd_plyr_wb6246
      @techiebd_plyr_wb6246 2 года назад

      @@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)

  • @MadheshwaranR-rs1yc
    @MadheshwaranR-rs1yc Год назад

    num1 = input ("value of a")
    num2 = input ("value of b")
    num1 = num2
    num2 = num1
    Print ("num1
    num2")

  • @karthisk1243
    @karthisk1243 Год назад

    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??

  • @BaldevPurohit
    @BaldevPurohit 2 года назад

    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?

    • @BaldevPurohit
      @BaldevPurohit 2 года назад

      Just watched 8th lecture again and i got my answer that it is print(string & integer) e.g. print("a=" +/, a) ✔️ 🤩

  • @SanjoyKumarMondol-go1vo
    @SanjoyKumarMondol-go1vo 13 дней назад

    # Prompt user to enter the value of a
    a = float(input("Enter the value of a: "))
    # Prompt user to enter the value of b
    b = float(input("Enter the value of b: "))
    # Calculate the sum of a and b
    sum_ab = a + b
    # Print the sum of a and b
    print("The sum of a and b is:", sum_ab)
    Is it correct?

  • @devagiri8746
    @devagiri8746 Год назад

    mam i have a doubt. In video at 21:20 duration time. u had printed jenny's
    "lectures" 5 times . right !. but it is printed side by side. if i want it 5 times downwards . . what is the code??

  • @maheshkasthuri5034
    @maheshkasthuri5034 Год назад

    I like ur real life examples mam 😂

  • @shoaibVELO
    @shoaibVELO 2 года назад +1

    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

  • @MayankYADAV-qs1ql
    @MayankYADAV-qs1ql 2 года назад +1

    Todays exercise -
    a=input("X= ")
    b=input("Y= ")
    c=a
    a=b
    b=c
    print("X= "+a)
    print("Y= "+b)

    • @vimalkumar281
      @vimalkumar281 2 года назад

      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?

  • @rajeshprasad3991
    @rajeshprasad3991 Год назад

    how to store two numbers in two different variable using one input statement
    for eg -
    if I say -
    Enter two numbers

  • @harshita7802
    @harshita7802 2 года назад

    Thank you so much mam for this course 😊

  • @satyarajkumarsatiwada410
    @satyarajkumarsatiwada410 2 года назад

    a=input ()
    b=input ()
    Print("a = " +b)
    Print("b = " + a)
    Out_put:
    a = 2
    b = 1
    In_put:
    1
    2
    Is it right?

  • @harshavardhanhoogar6658
    @harshavardhanhoogar6658 Год назад

    b=input("enter the value of a=")
    a=input("enter the value of b=")
    print("a=" +a)
    print("b=" +b)
    is it correct mam?

  • @NethminaKarunarathna-s5p
    @NethminaKarunarathna-s5p 18 дней назад

    a=input("Enter value of a = ")
    b=input("Enter value of b = ")
    print("a = "+b)
    print("b = "+a)
    mam we can use this way...Is it right madam?

  • @SubhashSB-gsoc
    @SubhashSB-gsoc Год назад

    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

  • @satya1459
    @satya1459 3 месяца назад

    may be this is easier try this
    a=10
    b=12
    a,b=b,a
    print(a)
    print(b)

  • @nsaikumar4771
    @nsaikumar4771 2 года назад

    Why should u use +a we can use print("a=" a)

  • @amansahu1096
    @amansahu1096 2 года назад

    Thank you for this course 😊 mem

  • @razeenrahuman7513
    @razeenrahuman7513 5 месяцев назад +1

    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???

  • @UttamPrakash
    @UttamPrakash 11 месяцев назад

    a=input("your value a:-")
    b=input("Your value b:-")
    print("a=" + b)
    print("b=" + a)
    it is simple why use temp?

  • @tinklingclaps2499
    @tinklingclaps2499 3 месяца назад

    Can you make a video with topics like escape,traverse,

  • @Kanugabyularani.03
    @Kanugabyularani.03 Год назад

    Could you please tell me madam, in case we entered "+" place to "-". It's solve?

  • @LingeshhvarenKA
    @LingeshhvarenKA 11 месяцев назад

    #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)

  • @harshtenguria8252
    @harshtenguria8252 9 месяцев назад

    can we use replace function
    to swap

  • @meditationworld9202
    @meditationworld9202 Год назад

    Why we need to concatenate in final print step i don understand this step can you explain madam.

  • @devil_shot5609
    @devil_shot5609 Год назад

    Mam your explanation is well but,we want some more examples

  • @adityajasud3961
    @adityajasud3961 2 года назад

    Mam ek simple aap our website ki kuch coding karke kisi koi opreting model me install ka koi video banayena

  • @keshettyrahul970
    @keshettyrahul970 6 месяцев назад

    can we write
    print(a)
    print(b)
    at the last 2 lines instead for that like...same ouput I
    got?

  • @MaryIheanaetu
    @MaryIheanaetu Год назад +1

    am a little bit confused in the swapping logic.

  • @sumantaff8446
    @sumantaff8446 2 года назад

    Chashma mei achhi lag rahi mam. Superb