@@ -35,24 +35,24 @@ def combinations(n: int, k: int) -> int:
35
35
# to calculate a factorial of a negative number, which is not possible
36
36
if n < k or k < 0 :
37
37
raise ValueError ("Please enter positive integers for n and k where n >= k" )
38
- return int ( factorial (n ) / (( factorial (k )) * ( factorial (n - k )) ))
38
+ return factorial (n ) // ( factorial (k ) * factorial (n - k ))
39
39
40
40
41
41
if __name__ == "__main__" :
42
42
43
43
print (
44
- "\n The number of five-card hands possible from a standard" ,
45
- f"fifty-two card deck is: { combinations (52 , 5 )} " ,
44
+ "The number of five-card hands possible from a standard" ,
45
+ f"fifty-two card deck is: { combinations (52 , 5 )} \n " ,
46
46
)
47
47
48
48
print (
49
- "\n If a class of 40 students must be arranged into groups of" ,
49
+ "If a class of 40 students must be arranged into groups of" ,
50
50
f"4 for group projects, there are { combinations (40 , 4 )} ways" ,
51
51
"to arrange them.\n " ,
52
52
)
53
53
54
54
print (
55
55
"If 10 teams are competing in a Formula One race, there" ,
56
56
f"are { combinations (10 , 3 )} ways that first, second and" ,
57
- "third place can be awarded.\n " ,
57
+ "third place can be awarded." ,
58
58
)
0 commit comments