标题:已经下载python如何应用?
只看楼主
ysr2857
Rank: 6Rank: 6
等 级:贵宾
威 望:28
帖 子:767
专家分:65
注 册:2020-2-10
得分:0 
while True:
    try:
        a = 1
        b = 0
        c = input('请输入一个数字:')
        c = eval(c)
        
        for i in range(c):
            
            e1 = int(i)
            w = ((15 + 4 * 14**0.5) ** (2 *  e1 + 1) + (15 - 4 * 14**0.5) ** (2 *  e1 + 1)-30)/224
            print(format(w))
            
    except:
        print("错误")
        exit()

[此贴子已经被作者于2023-2-8 15:05编辑过]

2023-02-08 14:21
ysr2857
Rank: 6Rank: 6
等 级:贵宾
威 望:28
帖 子:767
专家分:65
注 册:2020-2-10
得分:0 
这个程序精确度不高,应该出整数的咋都是小数:
请输入一个数字:50
0.0
119.99999999999997
107879.99999999997
96876239.99999996
86994755759.99995
78121193796359.95
7.0152745034375576e+16
6.299708691967547e+19
5.657131390112352e+22
5.0800976886122e+25
4.561922067242364e+28
4.096600936285955e+31
3.678743078862719e+34
3.3035071882177856e+37
2.966545776276492e+40
2.6639548035891015e+43
2.3922284470772363e+46
2.148218481520554e+49
1.9290978041770103e+52
1.7323276799324738e+55
1.555628327481557e+58
1.396952505750758e+61
1.2544617945358532e+64
1.1265052945406902e+67
1.0116005000357451e+70
9.084161225268044e+72
8.157566664285701e+75
7.325485780367334e+78
6.5782780732032e+81
5.907286384250693e+84
5.304736594779049e+87
4.763647554825201e+90
4.277750199496436e+93
3.8414149155002434e+96
3.4495863163690185e+99
3.0977246706844626e+102
2.7817533046883307e+105
2.49801136988545e+108
2.2432114284038293e+111
2.0144013646952683e+114
1.8089301822849225e+117
1.624417289290495e+120
1.4587249168526826e+123
1.3099333509164192e+126
1.1763186903980276e+129
1.0563328740440775e+132
9.485857445728913e+134
8.518289422935821e+137
7.64941441593892e+140
6.869165627223727e+143
请输入一个数字:


[此贴子已经被作者于2023-2-8 15:10编辑过]

2023-02-08 14:23
sssooosss
Rank: 9Rank: 9Rank: 9
等 级:禁止访问
威 望:3
帖 子:664
专家分:1115
注 册:2019-8-27
得分:0 
共同学习
2023-02-08 18:54
ysr2857
Rank: 6Rank: 6
等 级:贵宾
威 望:28
帖 子:767
专家分:65
注 册:2020-2-10
得分:0 
回复 23楼 sssooosss
互相切磋,共同进步!
祝新年宽了,万事如意,事业更上一层楼!
2023-02-08 20:18
ysr2857
Rank: 6Rank: 6
等 级:贵宾
威 望:28
帖 子:767
专家分:65
注 册:2020-2-10
得分:0 
while True:
    try:
        a = 1
        b = 0
        c = input('请输入一个数字:')
        c = eval(c)
        
        for i in range(c):
            
            e1 = int(i)
            w = ((1/2 + 5**0.5/2) ** e1  - (1/2 - 5**0.5/2) ** e1)/5**0.5
            print(format(w))
            
    except:
        print("错误")
        exit()
2023-02-09 06:47
ysr2857
Rank: 6Rank: 6
等 级:贵宾
威 望:28
帖 子:767
专家分:65
注 册:2020-2-10
得分:0 
这是兔子数列的程序,因该都是整数的,下面是前51项:

请输入一个数字:51
0.0
1.0
1.0
2.0
3.0000000000000004
5.000000000000001
8.000000000000002
13.000000000000002
21.000000000000004
34.00000000000001
55.000000000000014
89.00000000000003
144.00000000000006
233.00000000000006
377.00000000000017
610.0000000000003
987.0000000000005
1597.000000000001
2584.000000000002
4181.000000000003
6765.000000000005
10946.000000000007
17711.00000000001
28657.000000000022
46368.00000000004
75025.00000000006
121393.00000000009
196418.00000000017
317811.0000000003
514229.00000000047
832040.0000000008
1346269.0000000012
2178309.0000000023
3524578.0000000037
5702887.0000000065
9227465.000000011
14930352.000000019
24157817.000000026
39088169.000000045
63245986.00000007
102334155.00000013
165580141.00000024
267914296.00000036
433494437.0000006
701408733.0000011
1134903170.0000017
1836311903.0000026
2971215073.000005
4807526976.000008
7778742049.000013
12586269025.00002
请输入一个数字:




2023-02-09 06:49
ysr2857
Rank: 6Rank: 6
等 级:贵宾
威 望:28
帖 子:767
专家分:65
注 册:2020-2-10
得分:0 
while True:
    try:
        a = 1
        b = 0
        c = input('请输入一个数字:')
        c = eval(c)
        
        for i in range(c):
            
            e1 = int(i)
            w = ((1/2 + 5**0.5/2) ** e1  - (1/2 - 5**0.5/2) ** e1)/5**0.5
            w = int(w)
            print(format(w))
            
    except:
        print("错误")
        exit()
2023-02-09 06:52
ysr2857
Rank: 6Rank: 6
等 级:贵宾
威 望:28
帖 子:767
专家分:65
注 册:2020-2-10
得分:0 
加了个取整函数,这样就对了,下面是程序结果前51项:

请输入一个数字:51
0
1
1
2
3
5
8
13
21
34
55
89
144
233
377
610
987
1597
2584
4181
6765
10946
17711
28657
46368
75025
121393
196418
317811
514229
832040
1346269
2178309
3524578
5702887
9227465
14930352
24157817
39088169
63245986
102334155
165580141
267914296
433494437
701408733
1134903170
1836311903
2971215073
4807526976
7778742049
12586269025
请输入一个数字:

2023-02-09 06:54
ysr2857
Rank: 6Rank: 6
等 级:贵宾
威 望:28
帖 子:767
专家分:65
注 册:2020-2-10
得分:0 
请输入一个数字:61
0
1
1
2
3
5
8
13
21
34
55
89
144
233
377
610
987
1597
2584
4181
6765
10946
17711
28657
46368
75025
121393
196418
317811
514229
832040
1346269
2178309
3524578
5702887
9227465
14930352
24157817
39088169
63245986
102334155
165580141
267914296
433494437
701408733
1134903170
1836311903
2971215073
4807526976
7778742049
12586269025
20365011074
32951280099
53316291173
86267571272
139583862445
225851433717
365435296162
591286729879
956722026041
1548008755920
请输入一个数字:
2023-02-09 13:21
ysr2857
Rank: 6Rank: 6
等 级:贵宾
威 望:28
帖 子:767
专家分:65
注 册:2020-2-10
得分:0 
请输入一个数字:84
0
1
1
2
3
5
8
13
21
34
55
89
144
233
377
610
987
1597
2584
4181
6765
10946
17711
28657
46368
75025
121393
196418
317811
514229
832040
1346269
2178309
3524578
5702887
9227465
14930352
24157817
39088169
63245986
102334155
165580141
267914296
433494437
701408733
1134903170
1836311903
2971215073
4807526976
7778742049
12586269025
20365011074
32951280099
53316291173
86267571272
139583862445
225851433717
365435296162
591286729879
956722026041
1548008755920
2504730781961
4052739537881
6557470319842
10610209857723
17167680177565
27777890035288
44945570212853
72723460248141
117669030460994
190392490709135
308061521170129
498454011879265
806515533049395
1304969544928660
2111485077978055
3416454622906715
5527939700884771
8944394323791488
14472334024676260
23416728348467744
37889062373144008
61305790721611752
99194853094755776
请输入一个数字:
2023-02-09 19:29



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-511187-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.078228 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved