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 50a16a6

Browse files
changed the second condition
1 parent 18aff1d commit 50a16a6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎CH04/EX4.15.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,15 @@
2929

3030
if num == guess:
3131
print("Exact match. You won 10,000ドル")
32-
elif (g1 == n1 or g1 == n2 or g1 == n3) and (g2 == n1 or g2 == n2 or g2 == n3) and (g3 == n1 or g3 == n2 or g3 == 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):
3337
print("Match all digits: you win 3,000ドル")
3438
elif (g1 == n2 or g1 == n3
3539
or g2 == n1 or g2 == n3
3640
or g3 == n1 or g3 == n2):
3741
print("Match one digit: you win 1,000ドル")
3842
else:
39-
print("Sorry, no match")
43+
print("Sorry, no match")

0 commit comments

Comments
(0)

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