[PYTHON] Strengthen with code test ⑨

result

C87 Score 100 Time 15:41

To next time

Point 1

bin_str = format(int(status[1]), 'b') format () Integer for the first argument Mode selection for the second argument

Convert decimal numbers to binary numbers

Second argument Conversion destination
b Binary number
x Hexadecimal

Point 2

check_lsit[-int(target)] If the left side of the list is a large number and the right side is a small number

list

0 1 2 3
A B C D

When displaying A → B → C → D

python


for i in range(4):
    print(list[i])

When displaying D → C → B → A If it is range (4), it will be 0 to 3 and it will be -0 -1 -2 -3 Since it will be DCB, adjust it so that it becomes -1 -2 -3 -4. (Please let me know if there is any good way.)

python


for i in range(1,5):
    print(list[-i])
-4 -3 -2 -1
A B C D
code

python



input_line = input()
status = input_line.split()
bin_str = format(int(status[1]), 'b')#Point 1
check_lsit = list(bin_str)

for i in range(int(status[0])):
    target = input()
    print(check_lsit[-int(target)])#Point 2

Recommended Posts

Strengthen with code test ⑦
Strengthen with code test ③
Strengthen with code test ⑤
Strengthen with code test ④
Strengthen with code test ①
Strengthen with code test ⑧
Strengthen with code test ⑨
Primality test with Python
Primality test with python
Hamming code with numpy
In-house test code culture starting with just one person
Get country code with python
Python with VS Code (Windows 10)
Unit test flask with pytest
Test standard output with Pytest
Test code for evaluating decorators
Debug Python with VS Code
Load test Websocket with Locust
Check the code with flake8
Document Python code with Doxygen
Test Driven Development with Django Part 3
Decrypt the QR code with CNN
Java with Visual Studio Code (Part 2)
Test Driven Development with Django Part 4
Test Driven Development with Django Part 6
Classify "Wine" with TensorFlow MLP code
Test Driven Development with Django Part 2
test
Unit test log output with python
Write selenium test code in python
Try running Jupyter with VS Code
It was with Nintendo's Code Puzzle
Install python with mac vs code
Test Driven Development with Django Part 5
Controlling test reruns with Luigi + pytest
Automatic sample test case & manual input value test execution with VS Code with AtCoder
Python code to train and test with Custom Vision of Cognitive Service
[Python] Super easy test with assert statement
Stress Test with Locust written in Python
Test Python non-functional programs with GitLab CI
Image classification with Keras-From preprocessing to classification test-
Isn't it okay to write test code?
Generate Japanese test data with Python faker
Test Driven Development Startup with PySide & Pytest
Post Test 3 (Working with PosgreSQL in Python)
Pass PYTHONPATH in 1 minute with VS Code
Integrating with setuptools / python setup.py test / pytest-runner
Test automation starting with L-Chika (3) Oscilloscope integration
VS Code Pylint is annoying with import! !! !! !!
Automate Facebook App Testing with Facebook Test Users
python setup.py test the code using multiprocess