multiple lines of string in row

This is the place for queries that don't fit in any of the other categories.

multiple lines of string in row

Postby kostik » Fri Sep 27, 2013 6:24 pm

+---+
|
O
/|\
/ \ i need to print this picture of hang man 5 times in row....i tried this:

Code: Select all
 hang = """+---+
  |   |
  O   |
 /|\  |
 / \  |
      |
========"""
for x in range(5):
    print(hang,end="")


but of course with any achievment.... i tried also many other ways....what would be best approach to solve this problem?? thanks for any help
kostik
 
Posts: 13
Joined: Tue Apr 16, 2013 10:26 am

Re: multiple lines of string in row

Postby stranac » Fri Sep 27, 2013 8:04 pm

What's the problem with this code?
Do you get an error, or is the output wrong?
Friendship is magic!

R.I.P. Tracy M. You will be missed.
User avatar
stranac
 
Posts: 1097
Joined: Thu Feb 07, 2013 3:42 pm

Re: multiple lines of string in row

Postby kostik » Fri Sep 27, 2013 8:43 pm

The output is wrong....i want these "image" in row but just first line of second image is in row....also in wrong row
kostik
 
Posts: 13
Joined: Tue Apr 16, 2013 10:26 am

Re: multiple lines of string in row

Postby micseydel » Fri Sep 27, 2013 9:03 pm

The code you have prints each string, which is composed of multiple lines, one at a time. What you need to do is, for each line, print that line 5 times followed by a new line. str.split() may be of use to you.
Join the #python-forum IRC channel on irc.freenode.net!

Please do not PM members regarding questions which are meant to be discussed publicly. The point of the forum is so that others can benefit from it. We don't want to help you over PMs or emails.
User avatar
micseydel
 
Posts: 1223
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA


Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 5 guests