import math as m
(x,y)=eval(input("Enter a point with two coordinates:"))
s = m.sqrt(x**2+y**2)
if s<=10:
print("Point ",(x,y),'is in the circle')
else:
print("Point ",(x,y),'is not in the circle')
# Enter a point with two coordinates:4,5
# Point (4, 5) is in the circle
# Enter a point with two coordinates:9,9
# Point (9, 9) is not in the circle
2.编写程序:
t = 0
for i in range(100, 1001):
if i % 5 == 0 and i % 6 == 0:
print(i, end=' ')
t = t + 1
if t % 10 == 0:
print()
# 120 150 180 210 240 270 300 330 360 390
# 420 450 480 510 540 570 600 630 660 690
# 720 750 780 810 840 870 900 930 960 990
3.编写程序:
t = 0
for i in range(2001,2101):
if i%4==0 and i % 100 != 0 or i % 400 == 0:
print(i, end=' ')
t = t + 1
if t % 10 == 0:
print()
# 2004 2008 2012 2016 2020 2024 2028 2032 2036 2040
# 2044 2048 2052 2056 2060 2064 2068 2072 2076 2080
# 2084 2088 2092 2096
4.编写程序:
n = int(input('请输入一个整数:'))
i = 2 # 我们从二开始验证如120%2
while True:
if n % i == 0:
print(i, end=" ")
n /= i
else:
i += 1
if n == 1:
break
# 请输入一个整数:120
# 2 2 2 3 5