2

I am trying to get two values from the user and print a line of text with the user input.

char1 = input("Please enter the first character: ")
char2 = input("Please enter the secound character: ")

width = int(input("Please enter the width of the innermost triangle: "))

if width % 2 == 0:
    print ("ERROR - number is even")
    quit()

print ("")
print (char1*11,char2*1,char1*11)

This is my current output:

YYYYYYYYYYY + YYYYYYYYYYY

I am trying to print it with no spaces so that it looks like this:

YYYYYYYYYYY+YYYYYYYYYYY

How do I do this?

1

1 Answer 1

1

Print your output like this:

print ("{}{}{}".format(char1*11,char2*1,char1*11))

or you can use sep if you are using Python 3:

print (char1*11,char2*1,char1*11, sep="")

Read some more about printing here:

http://www.python-course.eu/python3_print.php

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.