Created
April 15, 2024 17:31
-
-
Save princesanjivy/0f062144261e58268e7d9b3b8c482df1 to your computer and use it in GitHub Desktop.
Demo
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
a=int(input("Enter the number of terms: ")) | |
k=0 | |
print("Enter",a,"terms: ") | |
for i in range(1,a+1): | |
ai=int(input()) | |
k+=ai | |
z=input("Enter 'A' if you want to get the Sum or Enter 'B' if you want to get the Average:") | |
if z=='A': | |
print("The Sum:",k) | |
elif z=='B': | |
print("The Average:",k/a) | |
else: | |
print("Invalid Option") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment