Skip to content

Instantly share code, notes, and snippets.

@Anequit
Created March 18, 2023 01:11
Show Gist options
  • Select an option

  • Save Anequit/6f167522f7e5e8bd40ab132f43527ee8 to your computer and use it in GitHub Desktop.

Select an option

Save Anequit/6f167522f7e5e8bd40ab132f43527ee8 to your computer and use it in GitHub Desktop.
min_year = 1972
initial_value = 4000
def solve(t: int) -> float:
try:
return round(initial_value * (2 ** (t / 2)), 2)
except OverflowError:
print("You're looking too far into the future.")
exit(1)
if __name__ == "__main__":
year = int(input("Year (>1972): "))
if year <= min_year:
print(f"Year must be greater than {min_year}.")
exit(1)
transistors = ("{:,}".format(solve(year - min_year)))
print(f"Transistor estimate: {transistors}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment