内容

  • 基本算术运算符
  • while-else
  • if-else
  • input()
  • int数据类型
  • math.log()和math.exp()
  • pow(x,y)

代码

1

a = int(input())
b = int(input())
c = int(input())
p = pow((c**2-3*b+a),2)
q = 5*a*c
t=2*p*q
print(t)

2

s = int(input())
i = 1
s = 2*s-1
while i>=3:
    i+=1
else:
    print(s)

3

import math

x = int(input())
if x>0:
    y = math.log(x)
else:
    y = math.exp(x)
print(y)

4

m = int(input())
n = int(input())
i = 1
m = m+2*i
n = n-2*i
while m<=n:
    i+=1
    m = m+2*i
    n = n-2*i
else:
    print(i)

5

s = 0 - 10
i = 1
while i>5:
    s=s+i
    i=i+1
else:
    print(s)

6

a = 0 - 5
b = 3
a = a * b
b = a - b
print(a-b)

7

a = 5
b = 7
c = 4
s = a + b + c
print(s / 3)

8

a = 3
b = 5
x = a
a = b
b = x
print(a - b)

9

x = int(input('x= '))
if x >= 0 - 3:
    y = x + 1
else:
    y = 0 - x - 5
print(y)

10

n = 1
m = 0
s = 0
m = 2 * n - 1
s = 2 * s + m
while n <= 4:
    n += 1
    m = 2 * n - 1
    s = 2 * s + m
else:
    print(s)

11

T = int(input())
t = 1
N = 1000
S = 0
while t <= T:
    S = S + N
    N = 0 - 0.1 * N
    t = t + 1
else:
    print(S)

12

s = 1
a=int(input())
i = 3
while i < a:
    s = s * i
    i = i + 2
else:
    pass
print(s)

废话

只是把高中数学课本必修三算法基础中的几道练习题用python写了出来而已