diff --git a/Fibonacci series.py b/py/Fibonacci series.py similarity index 100% rename from Fibonacci series.py rename to py/Fibonacci series.py diff --git a/py/guess_number.py b/py/guess_number.py new file mode 100644 index 0000000..02d50bf --- /dev/null +++ b/py/guess_number.py @@ -0,0 +1,27 @@ + +# 该实例演示了数字猜谜游戏 +number = 7 +guess = -1 +print("数字猜谜游戏!") +while guess != number: + guess = int(input("请输入你猜的数字:")) + + if guess == number: + print("恭喜,你猜对了!") + elif guess < number: + print("猜的数字小了...") + elif guess > number: + print("猜的数字大了...") + + +num=int(input("输入一个数字:")) +if num%2==0: + if num%3==0: + print ("你输入的数字可以整除 2 和 3") + else: + print ("你输入的数字可以整除 2,但不能整除 3") +else: + if num%3==0: + print ("你输入的数字可以整除 3,但不能整除 2") + else: + print ("你输入的数字不能整除 2 和 3") \ No newline at end of file