用python输入月日进行星座查询
时间: 2023-05-21 08:03:26 浏览: 125
可以使用以下代码进行星座查询:
```python
month = int(input("请输入出生月份:"))
day = int(input("请输入出生日期:"))
if month == 1 and day >= 20 or month == 2 and day <= 18:
print("水瓶座")
elif month == 2 and day >= 19 or month == 3 and day <= 20:
print("双鱼座")
elif month == 3 and day >= 21 or month == 4 and day <= 19:
print("白羊座")
elif month == 4 and day >= 20 or month == 5 and day <= 20:
print("金牛座")
elif month == 5 and day >= 21 or month == 6 and day <= 21:
print("双子座")
elif month == 6 and day >= 22 or month == 7 and day <= 22:
print("巨蟹座")
elif month == 7 and day >= 23 or month == 8 and day <= 22:
print("狮子座")
elif month == 8 and day >= 23 or month == 9 and day <= 22:
print("处女座")
elif month == 9 and day >= 23 or month == 10 and day <= 22:
print("天秤座")
elif month == 10 and day >= 23 or month == 11 and day <= 21:
print("天蝎座")
elif month == 11 and day >= 22 or month == 12 and day <= 21:
print("射手座")
elif month == 12 and day >= 22 or month == 1 and day <= 19:
print("摩羯座")
else:
print("输入错误")
```
请注意,这只是一个简单的星座查询程序,可能并不完全准确。
阅读全文