以下是判断象限的代码
from random import randint
x = randint(-10,10)
y = randint(-10,10)
z=(x,y)
print(z)
if x>0:
if y>0:
print(‘坐标在第一象限’)
elif y<0:
print(‘坐标在第四象限’)
else:
print(‘在x轴’)
elif x<0:
if y>0:
print(‘坐标在第二象限’)
elif y<0:
print(‘坐标在第三象限’)
else:
print(‘在x轴’)
elif x0 and y !=0:
print(‘y轴’)
else:
print(‘在原点’)
print(input())
from random import randint
x = randint(-10,10)
y = randint(-10,10)
z=(x,y)
print(z)
if x>0:
if y>0:
print(‘坐标在第一象限’)
elif y<0:
print(‘坐标在第四象限’)
else:
print(‘在x轴’)
elif x<0:
if y>0:
print(‘坐标在第二象限’)
elif y<0:
print(‘坐标在第三象限’)
else:
print(‘在x轴’)
elif x0 and y !=0:
print(‘y轴’)
else: