Python code
2 posters
Page 1 of 1
Python code
generating a random list of 30 integers and applying the insertion sorting.
This is what I have, but only prints 1 integer:
This is what I have, but only prints 1 integer:
- Code:
import random
N = 30 #defining number of elements
s = [] #defining list of elements
s.append ( int ( random.uniform ( 0, 30 ) ) )
def sort_numbers(s):
for i in range(1, N, len(s)):
# let's see what values i takes on
print ('i = '), i
val = s[i]
j = i - 1
while (j >= 0) and (s[j] > val):
s[j+1] = s[j]
j = j - 1
s[j+1] = val
print(s)
Pibor- Tier 4 (500 posts)
Re: Python code
Not sure if it'll help you, but Snow, one of our former Generals, is very experienced with Python and has a lot of video tutorials about it: https://www.youtube.com/user/sentdex
You could perhaps try to contact him on IRC, his name is Snow-Merchz and you can find him in the #Merchz channel.
Best of luck
You could perhaps try to contact him on IRC, his name is Snow-Merchz and you can find him in the #Merchz channel.
Best of luck
Similar topics
» Stuck on a python program
» Python Vacuum Robot Script
» Need someone to code a program for me in C#
» Code Inefficiency?
» Forum Code Issues
» Python Vacuum Robot Script
» Need someone to code a program for me in C#
» Code Inefficiency?
» Forum Code Issues
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|