We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b3c127e commit dd5bf99Copy full SHA for dd5bf99
Homework/lwt/lz_episode_01/2.Geometric_grade.py
@@ -0,0 +1,8 @@
1
+a = int(input("请输入首项a:"))
2
+q = int(input("请输入公比q:"))
3
+n = int(input("请输入项数n:"))
4
+
5
+sum = 0 #sum 为和
6
+for i in range(n): #从0到n-1
7
+ sum += a*(q**i) #加上每一项
8
+print('几何数级为:',sum)#输出和
0 commit comments