Discuss / Python / 作业。

作业。

Topic source

Dominias

#1 Created at ... [Delete] [Delete and Lock User]

-- coding: utf-8 --

import math

def quadratic(a, b, c): delta = (bb) - (4ac) if a == 0: x = -c/b return x elif delta < 0: return "No real solutions." else: x1 = (-b - math.sqrt(delta))/(2a) x2 = (-b + math.sqrt(delta))/(2*a) return x1, x2

逆红灯

#2 Created at ... [Delete] [Delete and Lock User]
import math

def move(x, y, step, angle=0):
    nx = x + step * math.cos(angle)
    ny = y - step * math.sin(angle)
    return nx, ny

x, y = move(100, 100, 60, math.pi / 6)
print(x, y)

>>>151.96152422706632 70.0

x, y = move(100, 100, 60, math.pi / 6) 关于这行代码,我想请问下是给 x 和 y 分别赋的什么值?


  • 1

Reply