Skip to content

Instantly share code, notes, and snippets.

@teromakotero
Created April 17, 2018 20:31
Show Gist options
  • Select an option

  • Save teromakotero/cc8d748727b298e80a13f847982012fe to your computer and use it in GitHub Desktop.

Select an option

Save teromakotero/cc8d748727b298e80a13f847982012fe to your computer and use it in GitHub Desktop.
Math exercises for first graders: addition exercises.
# coding:utf-8
import random
base = []
remedial = []
enrichment = []
kaalit = {
1:"M1A_07_002.png",
2:"M1A_07_001.png",
3:"M1A_02_007.png",
4:"M1A_02_008.png",
5:"M1A_02_009.png"
}
varpuset = {
1:"M1A_02_003.png",
2:"M1A_02_004.png",
3:"M1A_02_005.png",
4:"M1A_02_006.png",
5:"M1A_12_001.png"
}
porkkanat = {
1:"M1A_02_024.png",
2:"M1A_02_023.png",
3:"M1A_02_022.png",
4:"M1A_02_021.png",
5:"M1A_02_010.png"
}
vaihtoehdot = [kaalit,varpuset,porkkanat]
while(len(base) < 10):
num1 = random.randint(1,5)
num2 = random.randint(1,5)
if(num1 + num2 < 6):
string = str(num1) + " + " + str(num2) + " = "
if(base.count(string) == 0):
base.append(string)
print("")
print("Base:")
print("")
for i in base:
print(i)
print("")
while(len(remedial) < 10):
num1 = random.randint(1,5)
num2 = random.randint(1,5)
asia = vaihtoehdot[random.randint(0,2)]
if(num1 + num2 < 6):
string = asia[num1] + " " + asia[num2] + "\n" + str(num1) + " + " + str(num2) + " = "
if(remedial.count(string) == 0):
remedial.append(string)
print("")
print("Remedial:")
print("")
for j in remedial:
print(j)
print("")
while(len(enrichment) < 10):
num1 = random.randint(1,5)
num2 = random.randint(1,5)
num3 = random.randint(1,5)
if(num1 + num2 < 6):
string = str(num1) + " + " + str(num2) + " ___ " + str(num3)
if(enrichment.count(string) == 0):
enrichment.append(string)
print("")
print("Enrichment:")
print("")
for k in enrichment:
print(k)
print("")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment