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 = [] for num in map(int, input().split()): if num == -1: break nums.append(num) result = [] for n in nums: if n == 0: result.append('0') continue digits = [] current = n while current > 0: digits.append(str(current % 7)) current = current // 7 result.append(''.join(reversed(digits))) print(' '.join(result))
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.