You are given an integer N. You need to convert all zeroes of N to 5.
Input:
The first line of input contains an integer
Output:
For each test case, there will be a new line containing an integer where all zero's are converted to 5.
Your Task:
Your task is to complete the function
Expected Time Complexity:
Expected Auxiliary Space:
Constraints:
1 <= T <= 100
1 <= n <= 10000
Example:
Sample Input:
2
1004
121
Sample Output:
1554
121
Explanation:
Test Case 1:
Test Case 2:
_________________________________________
# Function should return an integer value
def convertFive(n):
n = str(n)
t = ""
for i in n:
if(i=='0'):
t +='5'
else:
t +=i
return t
n=1001
print(convertFive(n)
############################# OR #####################
# Function should return an integer value
def convertFive(n):
n= str(n)
n=n.replace('0','5')
return n
______________________________________________________________________
Comments
Post a Comment