code: def die_program(number_of_sides):
      
      prog = Program()
      n_qubits = qubits_needed(number_of_sides)
      ro = prog.declare('ro', 'BIT', n_qubits)
      # Hadamard initialize.
      for q in range(n_qubits):
          prog.inst(H(q))
      # Measure everything.
      for q in range(n_qubits):
          prog.measure(q, ro[q])
      return prog
docs: Generate a quantum program to roll a die of n faces.