Given a number N. The task is to complete the function convertFive() which replaces all zeros in the number with 5 and returns the number.
Example:
Input
2
1004
121
Output
1554
121
Explanation:
Testcase 1:  At index 1 and 2 there is 0 so we replace it with 5.
Testcase 2: There is no,0 so output will remain the same.
Input:
The first line of input contains an integer T, denoting the number of test cases. Then T test cases follow.
Each test case contains a single integer N denoting the number.
Output:
The function will return an integer where all zero's are converted to 5.
Your Task:
Since this is a functional problem you don't have to worry about input, you just have to complete the function convertFive().
Constraints:
1 <= T <= 10^{3}
1 <= N <= 10^{4}

Source: geeksforgeeks | Difficulty: EASY
Tags: Number theory

Mathematics

Starter code: #function should return an integer

#your task is to compplete this function

class Solution:

    def convertFive(self,n):

        #Code here

Solutions:
class Solution:

	def convertFive(self, n):
		return str(n).replace('0', '5')


class Solution:

	def convertFive(self, n):
		s = str(n)
		c = ''
		for char in s:
			if char == '0':
				c = c + '5'
			else:
				c = c + char
		return int(c)


class Solution:

	def convertFive(self, n):
		temp = str(n)
		for i in temp:
			if i == '0':
				temp = temp.replace(i, '5')
		return int(temp)


class Solution:

	def convertFive(self, n):
		s = str(n)
		n = ''
		for i in range(len(s)):
			if s[i] == '0':
				n += '5'
			else:
				n += s[i]
		n = int(n)
		return n


class Solution:

	def convertFive(self, n):
		return int(''.join([x if x != '0' else '5' for x in str(n)]))


class Solution:

	def convertFive(self, n):
		num = 0
		while n > 0:
			k = n % 10
			if k == 0:
				k = 5
			num = num * 10 + k
			n //= 10
		sum = 0
		while num > 0:
			sum = sum * 10 + num % 10
			num //= 10
		return sum


class Solution:

	def convertFive(self, n):
		t = 0
		x = 0
		while n > 0:
			d = n % 10
			if d == 0:
				x = x * 10 + 5
			else:
				x = x * 10 + d
			n = n // 10
		while x > 0:
			d = x % 10
			t = t * 10 + d
			x = x // 10
		return t


class Solution:

	def convertFive(self, n):
		x = str(n)
		x = x.replace('0', '5')
		return int(x)


class Solution:

	def convertFive(self, n):
		num_str = str(n)
		converted_str = ''
		for digit in num_str:
			if digit == '0':
				converted_str += '5'
			else:
				converted_str += digit
		return int(converted_str)


class Solution:

	def convertFive(self, n):
		sum = 0
		i = 0
		while n > 0:
			rem = n % 10
			if rem == 0:
				rem = 5
			sum = sum + rem * 10 ** i
			n = int(n / 10)
			i = i + 1
		return sum


class Solution:

	def convertFive(self, n):
		lst = list(str(n))
		for i in range(len(lst)):
			if int(lst[i]) == 0:
				lst[i] = '5'
		return ''.join(lst)


class Solution:

	def convertFive(self, n):
		a = []
		while n != 0:
			rem = n % 10
			if rem == 0:
				a.append(5)
			else:
				a.append(rem)
			n //= 10
		s = ''
		b = []
		b = a[::-1]
		for i in b:
			s += str(i)
		return int(s)


class Solution:

	def convertFive(self, n):
		lst = map(int, str(n))
		str1 = ''
		for i in lst:
			if i == 0:
				str1 += str(5)
			else:
				str1 += str(i)
		return str1


class Solution:

	def convertFive(self, n):
		n = str(n)
		ls = []
		for i in n:
			ls.append(int(i))
		for i in range(0, len(ls)):
			if ls[i] == 0:
				ls[i] += 5
		res = ''
		for i in ls:
			res += str(i)
		return int(res)


class Solution:

	def convertFive(self, n):
		b = n
		s = str(n)
		new = ''
		for j in s:
			if j == '0':
				new += '5'
			else:
				new += j
		new = int(new)
		return new


class Solution:

	def convertFive(self, n):
		n = str(n)
		n1 = n.replace('0', '5')
		n2 = int(n1)
		return n2


class Solution:

	def convertFive(self, n):
		l = [x for x in str(n)]
		for i in range(len(l)):
			if l[i] == '0':
				l[i] = '5'
		return ''.join(l)


class Solution:

	def convertFive(self, n):
		new = ''
		for i in str(n):
			if i == '0':
				new = new + '5'
			else:
				new = new + i
		return new


class Solution:

	def convertFive(self, n):
		cs = str(n)
		newcs = ''
		for i in cs:
			if i == '0':
				newcs += '5'
			else:
				newcs += i
		return int(newcs)


class Solution:

	def convertFive(self, n):
		rev = 0
		i = 1
		if n == 0:
			return '5'
		while n != 0:
			rem = n % 10
			if rem == 0:
				rem = 5
			rev = rev + rem * i
			i = i * 10
			n = n // 10
		return rev


class Solution:

	def convertFive(self, n):
		ans = ''
		n = str(n)
		for i in n:
			if int(i) == 0:
				ans += '5'
			else:
				ans += i
		return int(ans)


class Solution:

	def convertFive(self, n):
		li = []
		while n > 0:
			rem = n % 10
			li.append(rem)
			n = n // 10
		for i in range(len(li)):
			if li[i] == 0:
				li[i] = 5
		li.reverse()
		res = int(''.join(map(str, li)))
		return res


class Solution:

	def convertFive(self, n):
		n = str(n)
		while '0' in n:
			n = n.replace('0', '5')
		return n


class Solution:

	def convertFive(self, n):
		str2 = list(str(n))
		for i in range(len(str2)):
			if str2[i] == '0':
				str2[i] = '5'
		res = ''
		for i in range(len(str2)):
			res = res + str2[i]
		return int(res)


class Solution:

	def convertFive(self, n):
		ans = 0
		ls = []
		while n != 0:
			if n % 10 == 0:
				ls.append(5)
			else:
				ls.append(n % 10)
			n = n // 10
		ls = ls[::-1]
		for i in range(len(ls)):
			ans = ans * 10 + ls[i]
		return ans


def list_to_num(num_list):
	num_str = ''.join(map(str, num_list))
	return int(num_str)

class Solution:

	def convertFive(self, n):
		num = str(n)
		changednum = [0] * len(num)
		for i in range(0, len(num)):
			if num[i] != '0':
				changednum[i] = num[i]
			else:
				changednum[i] = '5'
		ans = list_to_num(changednum)
		return ans


class Solution:

	def convertFive(self, n):
		s = str(n)
		m = s.replace('0', '5')
		return m


class Solution:

	def convertFive(self, n):
		s = str(n)
		a = ''
		for i in s:
			if i == '0':
				a += '5'
			else:
				a += i
		return a


class Solution:

	def convertFive(self, n):
		str_n = str(n)
		new_str = str_n.replace('0', '5')
		return int(new_str)


class Solution:

	def convertFive(self, n):
		sum = 0
		sum1 = 0
		while n > 0:
			m = n % 10
			if m > 0:
				sum = sum * 10 + m
				n = n // 10
			elif m == 0:
				sum = sum * 10 + 5
				n = n // 10
		while sum > 0:
			k = sum % 10
			sum1 = sum1 * 10 + k
			sum = sum // 10
		return sum1


class Solution:

	def convertFive(self, n):
		num = str(n)
		newstr = ''
		for i in num:
			if i == '0':
				newstr += str(5)
			else:
				newstr += i
		return int(newstr)


class Solution:

	def convertFive(self, n):
		strN = str(n)
		newStr = ''
		for i in strN:
			if i == '0':
				newStr += '5'
			else:
				newStr += i
		return int(newStr)


class Solution:

	def convertFive(self, n):
		b = []
		s = 0
		out = 0
		while n:
			a = n % 10
			b.append(a)
			n = (n - a) / 10
			s = s + 1
		for i in range(s):
			if b[i] == 0:
				b[i] = 5
		for i in range(s):
			out = out * 10 + b[s - i - 1]
		return int(out)


class Solution:

	def convertFive(self, n):
		s = str(n)
		l = []
		for i in s:
			if i == '0':
				l.append('5')
			else:
				l.append(i)
		ns = ''
		for i in l:
			ns += i
		return int(ns)


class Solution:

	def convertFive(self, n):
		result = 0
		digit = 1
		while n > 0:
			if n % 10 == 0:
				result += 5 * digit
			else:
				result += n % 10 * digit
			n //= 10
			digit *= 10
		return result


class Solution:

	def convertFive(self, n):
		return ''.join([i.replace('0', '5') for i in str(n)])


class Solution:

	def convertFive(self, n):
		if n == 0:
			return 5
		ans = 0
		place = 1
		while n != 0:
			i = n % 10
			n = n // 10
			if i == 0:
				i = 5
			ans = ans + i * place
			place *= 10
		return ans


class Solution:

	def convertFive(self, n):
		a = str(n)
		if '0' in a:
			return int(a.replace('0', '5'))
		else:
			return n


class Solution:

	def convertFive(self, n):
		arr = str(n)
		res = ''
		for i in arr:
			if i == '0':
				res += '5'
			else:
				res += i
		return res


class Solution:

	def convertFive(self, n):
		s = str(n)
		s1 = s.replace('0', '5')
		return int(s1)


class Solution:

	def convertFive(self, n):
		con = str(n)
		newstring = ''
		for x in range(len(con)):
			newstring = con.replace('0', '5')
		return int(newstring)


class Solution:

	def convertFive(self, n):
		self.n = n
		cpy = str(n)
		new_cpy = cpy.replace('0', '5')
		return int(new_cpy)