Hello everyone,

I'm new to python, but I do have some c and c++ experience, although not extensive. I was looking through the challenges for new people that is stickied at the top of the forum, and was going to work on the * box challenge.

I'm going to have the user input the length and width of the box that should be printed, and make the box based on those specifications first. I've done this problem in c before, and it was no problem. In python, however, I have one simple question that has me stumped. If I do something like this:

while length >0:
    print "*"
    length = length-1

The program outputs all of the *s on different lines. I'm trying to get it to print the *s like this "*******", but don't know how to force the program to print them all on one line.

I know this is probably a simple problem to fix, and I've already tried searching google with no luck; I'm not exactly sure what it is I would even search for. Any help with this would be appreciated !

I would suggest creating the box in one string or several strings and then print that string.

Hi!

To make Python print everything on one line, use a ","

print "*",

But this doesn't really do what you want (I guess), because it leaves a space between the characters.

The way to go here, is

print "*" * 10

Easy, hm? :)

Regards, mawe

This question has already been answered. Start a new discussion instead.