Intermediate Level

Write the python program to Check the occurrence of given character in string


ur_input = input("Enter Some String: ")

chr_to_check = input("Enter Some Character: ")
res = ur_input.count(chr_to_check)

Write the python program to print the multiplication table


ur_input = int(input("Enter Some Number: "))
def printMultiplicationTable(num):
for i in range(1,11):
print(num*i)
printMultiplicationTable(ur_input)

Write the python program to generate the output based on the given input provided
i/p = [1,2,3,4,5]
o/p = [1,22,333,4444,55555]


in_ = [1,2,3,4]
out_ = [int(str(i)*i) for i in in_]
out_

Write the python program to remove duplicate characters from the string.


ur_input = input("Enter Some String: ")
with_out_duplicates = ''
for chr in ur_input:
if chr not in with_out_duplicates:
with_out_duplicates += chr
with_out_duplicates

Encode the last 5 character form the given number


ur_input = int(input("Enter Some Number: "))
def EncodeNumber(num):
str_rep = str(num)
temp_num = str_rep[:-5]
encode_num = temp_num+("X"*5)
return encode_num
res = EncodeNumber(ur_input)