Python Forum
How to remove empty line between two print functions - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: How to remove empty line between two print functions (/thread-8137.html)



How to remove empty line between two print functions - BigEasy - Feb-07-2018

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!!


RE: How to remove empty line between two print functions - buran - Feb-07-2018

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