Created
April 10, 2018 20:38
-
-
Save areyoualex/2a45b3d1f0c6b822807c458cf0a29935 to your computer and use it in GitHub Desktop.
A python snippet that will calculate a geometric sequence for you.
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
t1 = int(input("Enter the first term (t1): ")) | |
tn = int(input("Enter the final term (tn): ")) | |
diff = int(input("Enter the spaces in between: ")) | |
r = ( tn/t1 )**(1/(diff+1)) | |
print("R is "+str(r)); | |
print("t1 is "+str(t1)); | |
print("tn is "+str(tn)); | |
for i in range(1, diff+3): | |
print(str(i) +": " + str(t1*r**(i-1))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment