Answer to Question #230717 in Python for pavan

Question #230717

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


1
Expert's answer
2021-08-29T08:19:58-0400


#   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)




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS