Last active
September 10, 2022 07:14
-
-
Save kaubu/8dce84fc4811aef5e2c59b9bd6ad29c4 to your computer and use it in GitHub Desktop.
Calculate a number that is doubled over and over
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
base = float(input("What is the base number? ")) | |
double = int(input("How many times do you wish to double it? ")) | |
for i in range(1, double+1): | |
doubled_base = base * 2 | |
if doubled_base.is_integer(): | |
print(f"\n{doubled_base:.0f}\n\t\t(^ Number {i})") | |
else: | |
print(f"\n{doubled_base:.1f}\n\t\t(^ Number {i})") | |
base = doubled_base |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment