OK, I'm finally getting closer.
Code bellow (looks like) works if I comment out shuffle part
But I need it to shuffle so I get random picked words.
How do I get shuffle part to work?
from random import shuffle
import csv
print('Write translation of Slovene word ')
print()
Windows 7, Python 3.4.0
I have a simple translation refresher program that works.
For input I'm using TXT file, (prevedi.txt) words in it are separated by
coma that I'm editing, adding manually. (adding new 'refresher' words as
needed) And program works:
from random import shuffle
Hello Mario,
I think if you are facing the problem with shuffle, can the below solution
help:
import random
import csv
f = open('D:\\py.csv', 'r', newline='', encoding='utf8')
csvreader = csv.reader(f)
l = [row for row in csvreader] #we get rows in the file as a list using
list comprehension
On 04/07/14 02:07, Mario Py wrote:
How do I get shuffle part to work?
look at the random module.
there are several options in there, I think random.shuffle()
is your best bet.
hth
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/