def bubble_sort(a):
for i in range(0, len(a)):
for j in range(0, len(a) - 1):
if(a[i] < a[j]):
a[i], a[j] = a[j], a[i] #can someone explain this part of the code for me
#i tried doing (im more of a c++ programmer):
temp = 0
temp = a[i]
a[i] = a[j]
a[j] = temp
#but that didn't work well
fishsticks1907 0 Newbie Poster
Sahil89 0 Newbie Poster
woooee 814 Nearly a Posting Maven
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
woooee 814 Nearly a Posting Maven
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
Lardmeister 461 Posting Virtuoso
Lardmeister 461 Posting Virtuoso
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
Lardmeister 461 Posting Virtuoso
Lardmeister 461 Posting Virtuoso
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.