Menu Close

Return a string of its base 7 representation.

Given an integer num, return a string of its base 7 representation.

Input: 100

Output: "202"
import numpy as np
def tobase(num,b):
    return np.base_repr(num,base=b)  # can apply to any base not only base 7

num=int(input("Give an integer number : "))
b=7 # can change to any base
print(tobase(num,b))

Input_1:
Give an integer number : 100

Output:
202


Input_2:
Give an integer number : -7

Output:
-10


Input_3:
Give an integer number : 1446

Output:
4134


Input_4:
Give an integer number : 200
Output:
404


Input_5:
Give an integer number : 50
Output:
101


Illustration of the Output:

Executed using python3 linux

More Q