与变量一起使用的10e表示法? [英] 10e notation used with variables?

查看:82
本文介绍了与变量一起使用的10e表示法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何在python 2.7.9中使用带有变量的10eX表示法. 就字面量而言,10eX给出(10 ^ X).00000(浮点数). 我想使用一些变量而不是文字,但是它不起作用. 如果有可能,或者有其他方法,我应该在语法上进行哪些更改? 预先感谢!

I want to know how can I use the 10eX notation in python 2.7.9 with a variable. In terms of literals 10eX gives (10^X).00000(floating point number). I want to use some variable instead of literal, however, and it does not work. What syntactical change should I make if it is possible to do so or is there any other way to do so? Thanks in advance!

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

在运行解释器时,我遇到以下错误: 10e(N):语法无效

On running the interpreter I get error for- 10e(N) : Invalid Syntax

推荐答案

10e+410 * 10^4的表示法,而不是操作.您必须使用电源操作员:

10e+4is a notation for 10 * 10^4, not an operation. You have to use the power-operator:

low = 10 ** (N+1)
high = 10 ** (N+2)

这篇关于与变量一起使用的10e表示法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆