repl.it
@MerlinKnight/

data structures slide 2

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
array = [[[6,0],[4,0],[5,1],[9,0]],[[7,1],[5,0],[9,1],[8,1]],[[4,0],[2,1],[4,0],[2,0]],[[1,1],[7,0],[9,1],[2,0]],[[7,1],[1,1],[5,1],[7,0]]]
a = 1
while a == 1:
  year = int(input("Enter year 0,1,2... : "))
  print(" ")
  if year == 0:
    quarter = int(input("Enter quarter 1 - 4: "))
    if quarter >= 5:
      print("That was not between 1 - 4")
    else:
      dep = int(input("Enter department 0 = hardware, 1 = software: "))
      if dep >= 2:
        print("That was not between 0 - 1")
      else:
        num = int(input("Enter number: "))
        ((array[year])[quarter-1])[dep] = num
        print("this value has been stored")
        print(" ")
  else:
    total = ((array[year])[0])[0] + ((array[year])[1])[0] + ((array[year])[2])[0] + ((array[year])[3])[0]
    print(total,"is the number that year")
    print(" ")
  print("----------------------------------------------")
Fetching token
?