Moore’s Law is a prediction made by Intel co-founder Gordon Moore in 1965 that the number of transistors on a microprocessor chip would double every year. It is often quoted as “the number of transistors on a microprocessor doubles every 18 to 24 months”.
Here is how you can write a function in Python that calculates the number of transistors on a microprocessor chip based on Moore’s Law:
def moores_law(year):
transistors = 1
for i in range(year):
transistors *= 2
return transistors
print(moores_law(1)) # 2
print(moores_law(2)) # 4
print(moores_law(3)) # 8
Note that this is a simplification of Moore’s Law, and the actual number of transistors on a microprocessor chip may not exactly double every year or 18 to 24 months. This is just a rough approximation.