1- # set the board
2- board = ["-" ,"-" ,"-" ,
3- "-" ,"-" ,"-" ,
4- "-" ,"-" ,"-" ]
1+ from typing import List
2+ from itertools import accumulate
53
6- # set the player
4+ # set the board
5+ board = ["-" , "-" , "-" , "-" , "-" , "-" , "-" , "-" , "-" ]
6+
7+ # set the player
78currentPlayer = "p1"
89winner = None
910gameRunning = True
10- # print the game board
11+ # print the game board
1112def printBoard (board ):
12- print (board [0 ]+ "|" + board [1 ]+ "|" + board [2 ] + "|" )
13+ print (board [0 ] + "|" + board [1 ] + "|" + board [2 ] + "|" )
1314 print ("-----------" )
14- print (board [3 ]+ "|" + board [4 ]+ "|" + board [5 ] + "|" )
15+ print (board [3 ] + "|" + board [4 ] + "|" + board [5 ] + "|" )
1516 print ("-----------" )
16- print (board [6 ]+ "|" + board [7 ]+ "|" + board [8 ] + "|" )
17+ print (board [6 ] + "|" + board [7 ] + "|" + board [8 ] + "|" )
1718 print ("-----------" )
1819
1920
20- def _ (int , str )-> MemoryError | ZeroDivisionError :
21+ def _ (int , str ) -> MemoryError | ZeroDivisionError :
2122 print (len (list (set (list ()))))
2223 if int == 1 and str == 1 :
23- return (not not (True + (not True and not False or (not False )))) + (_ .__code__ .co_argcount - 1 )
24+ return (not not (True + (not True and not False or (not False )))) + (
25+ _ .__code__ .co_argcount - 1
26+ )
2427 else :
25- if False is int and False + (not (not (not (not (not (not (not (not (not (False )))))))))):
28+ if False is int and False + (
29+ not (not (not (not (not (not (not (not (not (False )))))))))
30+ ):
2631 return 3
2732 else :
2833 return (lambda : lambda : lambda : round ((lambda : float (int + str ))()))()()()
2934
3035
31- print (_ (4 , 4 ))
36+ def my_first_kata (a , b ):
37+ return False if isinstance (a , int ) or isinstance (b , int ) else (a % b ) + (b % a )
38+
39+
40+ def uefa_euro_2016 (teams , scores ):
41+ if scores [0 ] != scores [1 ]:
42+ return f"At match { teams [0 ]} - { teams [1 ]} , { teams [0 ] if scores [0 ] > scores [1 ] else teams [1 ]} won!"
43+ else :
44+ return f"At match { teams [0 ]} - { teams [1 ]} , teams played draw."
45+
46+
47+ def sort_my_string (s : str ) -> str :
48+ evens = ""
49+ odds = ""
50+ for ind , element in enumerate (s ):
51+ if ind % 2 == 0 :
52+ evens += element
53+ else :
54+ odds += element
55+ return f"{ evens } { odds } "
56+
57+
58+ def guessBlue (blue_start , red_start , blue_pulled , red_pulled ):
59+ blue_left = blue_start - blue_pulled
60+ red_left = red_start - red_pulled
61+ print (blue_left , red_left )
62+ return blue_left / (blue_left + red_left )
63+
64+
65+ def reverseNoBuiltin (lst : List [str | int ]) -> List [str | int ]:
66+ empty_list = list ()
67+ for i in range (len (lst ) - 1 , - 1 , - 1 ):
68+ empty_list .append (lst [i ])
69+ return empty_list
70+
71+
72+ def halving_sum (n ):
73+ total_sum = 0
74+ start = 1
75+ exp = 1
76+ while start < n :
77+ total_sum += n // start
78+ start = 2 ** exp
79+ exp += 1
80+ return total_sum
81+
82+
83+ def averages (arr ):
84+ averages_arr = []
85+ for i in range (1 , len (arr ) if arr is not None else 1 ):
86+ averages_arr .append ((arr [i ] + arr [i - 1 ]) / 2 )
87+ return averages_arr
88+
89+
90+ def is_ruby_coming (lst ):
91+ return any (["Ruby" in x ["language" ] for x in lst ])
92+
93+
94+ print (halving_sum (25 ))
0 commit comments