0 out of 464 challenges solved

Count Odd Binary Rotations

Write a Python function `count_odd_binary_rotations(binary_string, rotations)` that takes a binary string and a number of rotations as input. The function should determine how many of the rotated versions of the binary string represent an odd number when interpreted as a binary number.

A binary string is considered odd if its last character is '1'. Rotating a binary string means moving its last character to the front.

#### Example Usage
```python [main.nopy]
count_odd_binary_rotations("1011", 4)  # Output: 3
count_odd_binary_rotations("1100", 4)  # Output: 2
count_odd_binary_rotations("0000", 4)  # Output: 0
```

#### Constraints
- The input binary string will only contain '0' and '1'.
- The number of rotations will be a positive integer equal to the length of the binary string.
def count_odd_binary_rotations(binary_string, rotations):
    """
    Count the number of odd binary numbers obtained by rotating the binary string.

    Args:
    binary_string (str): The binary string to rotate.
    rotations (int): The number of rotations to perform.

    Returns:
    int: The count of odd binary numbers.
    """
    # Initialize the count of odd numbers
    odd_count = 0

    # Perform rotations and check for odd numbers
    for i in range(rotations):
        # Rotate the binary string
        # Check if the rotated string represents an odd number
        pass  # Replace with your implementation

    return odd_count