@@ -14,15 +14,15 @@ def is_good_number(number):
14
14
Let's a user know whether a number is properly formed.
15
15
Each number should be 5 digits long and should not repeat numbers.
16
16
17
+ :param number: int
18
+ :return: boolean
19
+
17
20
>>> is_good_number(12345)
18
21
True
19
22
>>> is_good_number(55432)
20
23
False
21
24
>>> is_good_number(444)
22
25
False
23
-
24
- :param number: int
25
- :return: boolean
26
26
"""
27
27
if not number :
28
28
return False
@@ -63,12 +63,43 @@ def report_results(user_number, secret_number):
63
63
Report how many digits are correct.
64
64
Report how many digits are in correct position.
65
65
66
+ :return: tuple
67
+
66
68
>>> report_results(54321, 12345)
67
- 'Digits correct: 5'
68
- 'Digits in correct position: 0'
69
+ (5, 0)
70
+ """
71
+ return 5 , 0
72
+ pass
73
+
74
+
75
+ def player_progress (num_of_guesses , user_guess , correct_digits , correct_pos_digits ):
76
+ """
77
+ Report the player's current progress.
69
78
79
+ Nums of guesses, their guess, num of correct digits,
80
+ and num of digits in the correct position.
81
+
82
+ :param num_of_guesses: int
83
+ :param user_guess: str
84
+ :param correct_digits: int
85
+ :param correct_pos_digits: int
70
86
:return: str
87
+
88
+ >>> player_progress(5, '12345', 4, 3)
89
+ ------------------------------
90
+ Used guesses: 5
91
+ User guess: 12345
92
+ Digits correct: 4
93
+ Digits in correct position: 3
94
+ ------------------------------
71
95
"""
96
+
97
+ print ('------------------------------' )
98
+ print ('Used guesses: {}' .format (5 ))
99
+ print ('User guess: {}' .format ('12345' ))
100
+ print ('Digits correct: {}' .format (4 ))
101
+ print ('Digits in correct position: {}' .format (3 ))
102
+ print ('------------------------------' )
72
103
pass
73
104
74
105
0 commit comments