Предизвикателства > Осем-измерна битова баница с късмет > Решения > Решението на Илиан Запрянов

Резултати
1 точки от тестове
0 точки от учител

1 точки общо

1 успешни теста
0 неуспешни теста
Код

 1from secret import clue
 2
 3def lucky():
 4    """
 5    Izshani loshite.
 6    
 7    Returns:
 8        https://www.youtube.com/watch?v=GOcax2aLUtg
 9    """ 
10    
11    first_three_bits = clue(right_shift=5) << 5
12    last_three_bits = clue(left_shift=5) >> 5 
13    middle_bits = clue(bw_and=0b00010000) | (clue(bw_or=0b11110111) ^ 0b11110111)
14
15    return first_three_bits | middle_bits | last_three_bits

.
----------------------------------------------------------------------
Ran 1 test in 0.004s

OK

Дискусия
История

t1from secret import cluet1from secret import clue
22
3def lucky():3def lucky():
4    """4    """
5    Izshani loshite.5    Izshani loshite.
6    6    
7    Returns:7    Returns:
8        https://www.youtube.com/watch?v=GOcax2aLUtg8        https://www.youtube.com/watch?v=GOcax2aLUtg
9    """ 9    """ 
10    10    
11    first_three_bits = clue(right_shift=5) << 511    first_three_bits = clue(right_shift=5) << 5
12    last_three_bits = clue(left_shift=5) >> 5 12    last_three_bits = clue(left_shift=5) >> 5 
13    middle_bits = clue(bw_and=0b00010000) | (clue(bw_or=0b11110111) ^ 0b11110111)13    middle_bits = clue(bw_and=0b00010000) | (clue(bw_or=0b11110111) ^ 0b11110111)
1414
15    return first_three_bits | middle_bits | last_three_bits15    return first_three_bits | middle_bits | last_three_bits
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op