Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 159489f

Browse files
Update EX4.15.py
1 parent 50a16a6 commit 159489f

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

‎CH04/EX4.15.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
import random
1111

1212
num = random.randint(100, 999)
13-
print(str(num))
1413
guess = int(input("Enter 3 digit number: "))
1514

1615
NUM = num
1716
GUESS = guess
17+
1818
g1 = GUESS // 100
1919
GUESS %= 100
2020
g2 = GUESS // 10
@@ -29,15 +29,15 @@
2929

3030
if num == guess:
3131
print("Exact match. You won 10,000ドル")
32-
elif (g1 == n1 and g3 == n2 and g2 == n3 or
33-
g2 == n1 and g1 == n2 and g3 == n3 or
34-
g2 == n1 and g3 == n2 and g1 == n3 or
35-
g3 == n1 and g1 == n2 and g2 == n3 or
36-
g3 == n1 and g2 == n2 and g1 == n3):
32+
elif (g1 == n1 and g3 == n2 and g2 == n3 or
33+
g2 == n1 and g1 == n2 and g3 == n3 or
34+
g2 == n1 and g3 == n2 and g1 == n3 or
35+
g3 == n1 and g1 == n2 and g2 == n3 or
36+
g3 == n1 and g2 == n2 and g1 == n3):
3737
print("Match all digits: you win 3,000ドル")
38-
elif (g1 == n2 or g1 == n3
39-
or g2 == n1 or g2 == n3
40-
or g3 == n1 or g3 == n2):
38+
elif (g1 == n1org1==n2 or g1 == n3
39+
or g2 == n1 or g2 == n2org2==n3
40+
or g3 == n1 or g3 == n2org3==n2):
4141
print("Match one digit: you win 1,000ドル")
4242
else:
43-
print("Sorry, no match")
43+
print("Sorry, no match")

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /