#70 Python Tutorial for Beginners | Bubble Sort in python | List Sort

///#70 Python Tutorial for Beginners | Bubble Sort in python | List Sort

#70 Python Tutorial for Beginners | Bubble Sort in python | List Sort

FavoriteLoadingAdd to favorites

Sorting the list using Bubble Sort in Python.
#bubblesort
#python

Python Tutorial to learn Python programming with examples
Complete Python Tutorial for Beginners Playlist :
Python Tutorial in Hindi :

Github :-

Editing Monitors :

Check out our website:

Follow Telusko on Twitter:

Follow on Facebook:
Telusko :
Navin Reddy :

Follow Navin Reddy on Instagram:

Subscribe to our other channel:
Navin Reddy :
Telusko Hindi :

Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20

source

By |2020-10-23T10:14:56+00:00October 23rd, 2020|Python Video Tutorials|25 Comments

25 Comments

  1. Harshdeep Singh October 23, 2020 at 10:15 am - Reply

    Sir
    def sort(nums):

    for i in range(len(nums)-1,0,-1):

    for j in range(i):

    if nums[j]>nums[j+1]:

    temp=nums[j]

    nums[j]= nums[j+1]

    nums[j+1]= temp

    nums = [9,1,6,8,7]

    print(nums)

    Me
    nums = [9,1,6,8,7]

    print(sorted(nums))
    that's it

  2. Anantprakash Gupta October 23, 2020 at 10:15 am - Reply

    very helpful sir thank you

  3. Ashhh October 23, 2020 at 10:15 am - Reply

    a=[6,3,2,5,7,8,67,43,23,56,343]
    def sort(a):
    for i in range(len(a)-1,0,-1):
    for j in range(i):
    if a[j]>a[j+1]:
    temp=a[j]
    a[j]=a[j+1]
    a[j+1]=temp

    return a
    print(sort(a))

  4. Ravikanth Talakoti October 23, 2020 at 10:15 am - Reply

    Navin sir, you are teaching great! 🙂

  5. PADALA LIKHITH RISHI October 23, 2020 at 10:15 am - Reply

    we didnot return nums then how the output is coming?

  6. Rohit Singh October 23, 2020 at 10:15 am - Reply

    can we swaping like this–
    num[j],num[j+1]=num[j+1],num[j]

  7. Rohit Singh October 23, 2020 at 10:15 am - Reply

    num=[5,7,4,8,9,2]

    def bubblesort(num):

    for i in range(len(num)-1,0,-1):

    for j in range(i):

    if num[j]>num[j+1]:

    num[j],num[j+1]=num[j+1],num[j]

    bubblesort(num)

    print(num)

  8. Ahnaf Rahman October 23, 2020 at 10:15 am - Reply

    I absolutely love this dude idek why

  9. Nya Sha October 23, 2020 at 10:15 am - Reply

    damn!!!! you good

  10. Gopala krishna October 23, 2020 at 10:15 am - Reply

    I will be waiting to our online class

  11. Souvik Mallik October 23, 2020 at 10:15 am - Reply

    Sorry, but I got confused in this. Specially the outer loop logic. Can you please elaborate using outer and inner loops.

  12. Aharth Dhivar October 23, 2020 at 10:15 am - Reply

    hey, I'm not alien ok.

  13. shreenidhi s October 23, 2020 at 10:15 am - Reply

    Hi Sir,
    why this code needs to return ??
    def fact(n):

    f=1

    for i in range(1,n+1):

    f=f*i

    return f

    x=5

    res=fact(x)

    print(res)

    and y bubble sort doesn't need return??

  14. Nirusan Hariharan October 23, 2020 at 10:15 am - Reply

    Sir 5:20 "6-1" or "5-1"

  15. Gaurav Kandekar October 23, 2020 at 10:15 am - Reply

    I didn't get the logic

  16. Arul October 23, 2020 at 10:15 am - Reply

    Your explanation made me to think all types of solution sir;
    I have a logic, here you gooo <3

    def sort(nums):

    for i in range(len(nums)):

    for j in range(i+1,len(nums)):

    if nums[j]<nums[i]:

    nums[i],nums[j]=nums[j],nums[i]

    return nums

    sort([1,23,4,545])

  17. Harshad Daingade October 23, 2020 at 10:15 am - Reply

    def sort(nums):

    for i in range(len(nums) – 1, 0, -1):

    for j in range (i):

    if nums[j] < nums[j + 1]:

    continue

    else:

    nums[j+1], nums[j] = nums[j], nums[j+1]

    nums = [5, 8, 9, 71, 10, 2,589,1,0]

    sort(nums)

    print(nums)

  18. Tirth Patel October 23, 2020 at 10:15 am - Reply

    Hello everyone, I have a doubt if anyone can please help me with it and answer, I didn't understand the range that we took!, (-1,0,-1)

  19. Misan October 23, 2020 at 10:15 am - Reply

    How would i do this for lists with elements which are made up if both strings and integers? Please help me

  20. Pooja Sridharan October 23, 2020 at 10:15 am - Reply

    Can anyone say why he used the range as range(nums(len)-1,0,-1)…. Why is it from the last? please clear my doubt anyone..

  21. Imran Hossain October 23, 2020 at 10:15 am - Reply

    dark mode please

  22. Muhammad Ibrahim October 23, 2020 at 10:15 am - Reply

    i want to sort a array string like {"Man","cda","zyx"} to {"amn","abc","xyz"} please help me i want it algoritium

  23. Bryanseah234 October 23, 2020 at 10:15 am - Reply

    why the first for loop cannot be
    for i in range(0, len(num)) OR
    for i in range(0, len(num)-1) OR
    for i in range(len(num)-1, 0)

  24. Ashish Sharma October 23, 2020 at 10:15 am - Reply

    I use this simple logic-
    Please thumbs up if you find this convenient:
    .
    def bubble(list):
    for i in range(len(list)-1):
    if list[i]>list[i+1]:
    list[i],list[i+1]=list[i+1],list[i]
    bubble(list)
    else:
    pass
    list=[88,55,10,0,66,12,99]
    bubble(list)
    print("final list is",list)

  25. Nellai appan October 23, 2020 at 10:15 am - Reply

    It had been very very useful for my son during lockdown
    Thank you sir😊☺️

Leave A Comment

*