-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") |