Nis*_*gar 3 python floating-point python-2.7
我想知道如何在python 2.7.9中使用带有变量的10eX表示法。就字面量而言,10eX给出(10 ^ X).00000(浮点数)。我想使用一些变量而不是文字,但是它不起作用。如果有可能或应该采取其他方法,我应该进行什么语法更改?提前致谢!
T = int(raw_input())
while T:
N = int(raw_input())
LIS = map(int,raw_input().split())
num_lis, num = []*N, []*N
low = int(10e+(N))
high = int(10e+(N+1))
temp, count = 0, 0
for i in xrange(low,high):
num_lis = [1]*N
temp = i
while temp!=0:
r = temp%10
num[high-1-i] = r
temp=temp/10
for p in xrange[1,N]:
for q in xrange(0,p):
if num[q]<num[p]:
if num_lis[p]<(num_lis[q]+1):
num_lis[p]=num_lis[q]+1
if LIS[p]!=num_lis[p]:
break
else:
count++
print count
T-=1
Run Code Online (Sandbox Code Playgroud)
运行解释器时出现错误-10e(N):语法无效
10e+4是的符号10 * 10^4,不是操作。您必须使用电源操作员:
low = 10 ** (N+1)
high = 10 ** (N+2)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5092 次 |
| 最近记录: |