Python Forum

Full Version: How to remove empty line between two print functions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I'm new to python and this is my first post.

I'm trying to write a function that would need me to print a triangle made of "*"s

Here is my program:

# Type your code here

n = int(input("Enter a positive integer greater than or equal to 3: "))

count = 1
star = "*"
for x in range(0, n):
    print(star*count)
    count += 1
print()

count_ = n-1
star_ = "*"
for a in range(0,n-1):
    print(star_*count_)
    count_ -= 1
print()
When I print it for the value of 6, I get the following:

Output:
Enter a positive integer greater than or equal to 3: 6 * ** *** **** ***** ****** ***** **** *** ** *
My question is, how do I remove that empty line between where the first function ends and the new one begins?

I apologize if this is a really easy fix, but I have only been coding for 1 week now. So I could use all the help I can get.

Thank you!!
well. remove the print() on line 10
also note that you don't have any functions in your code. That said - you may want to refactor your code with using function to avoid repetative code