import random
import itertools
import collections
res = [random.randrange(1, 8, 1) for i in range(1)]
print(res)
n1 = [1]
n2 = [2]
n3 = [3]
n4 = [4]
n5 = [5]
n6 = [6]
n7 = [7]
f= open("memory.txt","a+")
f.write("%s\n" % (res))
f.close()
f= open("memory.txt","r")
f1 = f.readlines()
for
class cereal:
def __init__(self, name, flavor, type,):
self.name = name
self.flavor = flavor
self.type = type
o = "round"
c = "crunchy"
w = "wafer"
s = "soft"
p = "part crunchy part soft"
cheerios_special = cereal("cheerios with a hint of syrup", "incredible", o)
cheerios = cereal("cheerios", "bland", o)
fruit_loops = cereal("fruit loops", "fruity", o)
captain_crunch = cereal("captain crunch", "captain crunchy", c)
life_norm = cereal("Life", "bland", w)
life_cin = cereal("Life", "cinamon", w)
lucky_charms = cereal("lucky charms", "magical", p)
x1 = cheerios.name
x2 = cheerios.flavor
x3 = cheerios.type
y1 = fruit_loops.name
y2 = fruit_loops.flavor
y3 = fruit_loops.type
z1 = captain_crunch.name
z2 = captain_crunch.flavor
z3 = captain_crunch.type
l1 = life_norm.name
l2 = life_norm.flavor
l3 = life_norm.type
l4 = life_cin.name
l5 = life_cin.flavor
l6 = life_cin.type
c1 = lucky_charms.name
c2 = lucky_charms.flavor
c3 = lucky_charms.type
o1 = cheerios_special.name
o2 = cheerios_special.flavor
o3 = cheerios_special.type
if res == [1]:
print("you should %s %s it tastes %s and is %s" % (x1, sr1, x2, x3))
if res == [2]:
print("you should %s %s it tastes %s and is %s" % (y1, sr2, y2, y3))
if res == [3]:
print("you should %s %s it tastes %s and is %s" % (z1, sr3, z2, z3))
if res == [4]:
print("you should %s %s it tastes %s and is %s" % (l1, sr4, l2, l3))
if res == [5]:
print("you should %s %s it tastes %s and is %s" % (l4, sr5, l5, l6))
if res == [6]:
print("you should %s %s it tastes %s and is %s" % (c1, sr6, c2, c3))
if res == [7]:
print("you should %s %s it tastes %s and is %s" % (o1, sr7, o2, o3))
that is my current code the for is empty because I didn't finish I need to find a way to count characters that are repeated in a file and then change a variable if it is counted 2 or more.