Write a program that reads a single line of input and prints the first and last characters of the given input and prints the asterisk character (*) in place of the remaining characters.Input
# Write a program that reads a single line of input and
# prints the first and last characters of the given input and
# prints the asterisk character (*) in place of the remaining characters.Input
s = str(input("Enter Input: "))
u=[]
k=""
for r in range(0,len(s)):
if(r==0): u.append(s[0])
if(r==len(s)-1): u.append(s[len(s)-1])
if(r>0 and r<len(s)-1): u.append("*")
k=k+str(u[r])
print(k)
Comments
Leave a comment