+10 XP
Numbers: int and float
Python has two types of numbers:
• int — whole numbers: 1, 42, -70
• float — decimal numbers: 3.14, -70.5, 0.001
python
n_neurons = 100 # int — whole number
dt = 0.001 # float — time step (1 ms)
V_rest = -70.0 # float — resting potential in mV
print(type(n_neurons)) # <class 'int'>
print(type(dt)) # <class 'float'>In NMA, you'll use floats for most neuroscience values (voltages, times, rates).
Math works exactly as you'd expect:`
2 + 3 → 5 (addition)
10 - 4 → 6 (subtraction)
3 * 4 → 12 (multiplication)
10 / 3 → 3.33 (division — always gives float)
10 ** 2 → 100 (power: 10 squared)`
Pro tip: In Python, 10 / 3 = 3.333... (not 3). For whole-number division use 10 // 3 = 3.