Generation

generate functionSat, 28 Jan 2023

x=4**2022-6*4**522+5*64**510-3*2**330-100 x is translated into the number system with the base 8. Determine the number of digits "7" in the record of this number

def count_7(number): base = 8 result = 0 while number > 0: digit = number % base if digit == 7: result += 1 number = number // base return result

Questions about programming?Chat with your personal AI assistant