George is getting tired of the decimal number system. He intends to switch and use the…
- User
George is getting tired of the decimal number system. He intends to switch and use the septenary (base 7) number system for his future needs. Write a program to help George start his transformation into the septenary number system by taking in a list of decimal numbers and print out the corresponding septenary number. Input A list of numbers in decimal format ending with -1.
Output A list of numbers in septenary.
Example Input: 1 2 88 42 99 -1
Output: 1 2 154 60 201
Assistant
pythonnums = list(map(int, input().split())) output = [] for n in nums: if n == -1: break if n == 0: output.append('0') continue digits = [] num = n while num > 0: digits.append(str(num % 7)) num = num // 7 output.append(''.join(reversed(digits))) print(' '.join(output))
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.