#record.py #demo use of class to make a record, or struct, type class record: def __init__(self,id,name,amount,measure): self.id = id self.name = name self.amount = amount self.measure = measure def __str__(self): return(str(self.id) + " " + self.name + " " + str(self.amount) + " " + str(self.measure)) rec1 = record(234,"gizmo",34,123.45) rec2 = record(567,"widget",23,54.2) print(rec1.id,rec1.name,rec1.amount,rec1.measure) print(rec1) def make_random_record(): from random import randint from random import choice from random import random vowels = ['a','e','i','o','u'] consonants = ['b','c','d','f','g','h','k','l','m','n','p','r','s','t','v','w','z'] id = randint(1,1000000) name = choice(consonants) +\ choice(vowels) +\ choice(consonants) +\ choice(vowels) +\ choice(consonants) +\ choice(vowels) amount = randint(0,100) measure = round(random() * 100, 3) return record(id,name,amount,measure) print(make_random_record()) print(make_random_record()) size = 10 list_records = [] for i in range(size): list_records.append(make_random_record()) for rec in list_records: print(rec, end=" ")