In: Computer Science
17.18 LAB 8A: Input and formatted output: Left-facing arrow
You will be working on generating a formatted output using characters such as *, #, -, +.
You need to prompt the user for a character for the arrowhead, and a character for the arrow body, and then print a left-facing arrow. Your prompts should be exactly "Enter a character for the arrowhead:" and "Enter a character for the arrow body:", as shown below.
Ex: If the user inputs a * after the first prompt, and a # after the second prompt,
Enter a character for the arrowhead:# Enter a character for the arrow body:*
Then the output is:
# ##***** ###***** ##***** #
can you help me with writing this code in Python?
Code and output
Code for copying
a=str(input("Enter a character for the arrowhead:"))
b=str(input("Enter a character for the arrowbody:"))
print(" {}".format(a))
print(" {}{}".format(a*2,b*5))
print("{}{}".format(a*3,b*5))
print(" {}{}".format(a*2,b*5))
print(" {}".format(a))
Code snippet
a=str(input("Enter a character for the arrowhead:"))
b=str(input("Enter a character for the arrowbody:"))
print(" {}".format(a))
print(" {}{}".format(a*2,b*5))
print("{}{}".format(a*3,b*5))
print(" {}{}".format(a*2,b*5))
print(" {}".format(a))