Dear group,
I'm having a bit of trouble with understanding why my bubble sort
implementation doesn't work. I've got the following function to perform a
bubble sort operation on a list of numbers:
def bubble_sort_ascending(unsorted):
""" Sorts a list of numbers into ascending order """
Spyros Charonis Wrote in message:
>
> Dear group,
> I'm having a bit of trouble with understanding why my bubble sort
> implementation doesn't work. I've got the following function to perform a
> bubble sort operation on a list of numbers:
> def bubble_sort_ascending(unsorted):
> """ Sort
I accidentally sent my last email from my work email. I recently added my
gmail account to MS exchange and I forget I have to change where I send the
mail from now that I have two accounts in exchange. Sorry for any confusion.
___
Tutor maillist - Tut
On 15/11/14 16:46, Spyros Charonis wrote:
def bubble_sort_ascending(unsorted):
iterations = 0
size = len(unsorted) - int(1)
Don't convert 1 to an int - it already is.
for i in range(0, size):
This will result in 'i' going from zero to len()-2.
Is that what you want?
Thank you Alan,
When I initiated the loop with the condition:
for i in range(len(unsorted)):
Python raised an IndexError saying I had gone out of bounds. Hence the
change to:
for i in range(0, size)
Yes, I actually the loop only consists of:
while unsorted[i] > unsorted[i+1]:
# Use a
Thank you Alan and Danny. It amazes me at the lengths you guys, as well as
everyone else who contributes, will go to to help explain things to us; it is
greatly appreciated!
Alan, I decided to dumb down the learning classes just a little. By this I
mean, I am not using Tkinter to learn classes
On 15/11/14 18:19, Bo Morris wrote:
With the first part…
class Message:
def __init__(self, aString):
self.text = aString
Will I always use “_init_” when defining the first function in a class?
It can go anywhere in the class definition. it is just another method of
the class. Bu
Below was the post that was sent from the wrong email. Not sure if the first
post went through, so in the event it did not, I will post again; if it was
posted twice, I apologize for the redundancy.
Subject: Re: Help understanding classes
Thank you Alan and Danny. It amazes me at the lengths y
On Sat, Nov 15, 2014 at 04:46:26PM +, Spyros Charonis wrote:
> Dear group,
>
>
> I'm having a bit of trouble with understanding why my bubble sort
> implementation doesn't work. I've got the following function to perform a
> bubble sort operation on a list of numbers:
It doesn't work because
On Sat, Nov 15, 2014 at 06:19:56PM +, Bo Morris wrote:
> Thank you Alan and Danny. It amazes me at the lengths you guys, as well as
> everyone else who contributes, will go to to help explain things to us; it
> is greatly appreciated!
>
> Alan, I decided to dumb down the learning classes ju
10 matches
Mail list logo