Quantum mechanics tells us that a molecule is only allowed to have specific, discrete amounts of internal energy. The 'rigid rotor model', a model for describing rotations, tells us that the amount of rotational energy a molecule can have is given by:  

`E =  B * J * (J + 1)`, 

where J is the state the molecule is in, and B is the 'rotational constant' (specific to the molecular species).

Write a function that returns an array of allowed energies for levels between Jmin and Jmax.

Notes:

* return empty array if Jmin is greater than Jmax (as it make no sense).
* Jmin, Jmax are integers.
* physically B must be positive, so return empty array if B <= 0

Difficulty: EASY
Starter code: def rot_energies(B, Jmin, Jmax):
	

Solutions:
def rot_energies(B, Jmin, Jmax):
	return [B * J * (J + 1) for J in range(Jmin, Jmax + 1)] if B > 0 else []


def rot_energies(rot, energy_min, energy_max):
	if rot <= 0:
		return []
	else:
		return [rot * energy * (energy + 1) for energy in range(energy_min, energy_max + 1)]


def E(B, J):
	return B * J * (J + 1)

def rot_energies(B, Jmin, Jmax):
	if B < 0 or Jmax < Jmin:
		return []
	return [E(B, j) for j in range(Jmin, Jmax + 1)]


def rot_energies(B, Jmin, Jmax):
	result = []
	if B >= 0:
		for a in range(Jmin, Jmax + 1):
			result.append(B * a * (a + 1))
	return result


def rot_energies(B, Jmin, Jmax):
	return [] if B < 0 or Jmin > Jmax else [B * i * (i + 1) for i in range(Jmin, Jmax + 1)]