Python Forum
Wrong output from script mode
Thread Rating:
  • 3 Vote(s) - 3.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wrong output from script mode
#1
I'm at the beginning of the second lesson in the Python programming book "Python programming for the absolute beginner 3rd edition". The end product is supposed to look like this.

Programme 'Game Over' 2.0
Same message as before.
Just a bit bigger...
Output:
_____ ___ ___ ___ _____ / ___| / | / |/ | | ___| | | / /| | / /| /| | | |___ | | _ / ___ | / / |__/ | | | ___| | | | | / / | | / / | | | |___ \_____/ /_/ |_| /_/ |_| |_____| _____ _ _ _____ _____ / _ \ | | / / | ___| | _ \ | | | | | | / / | |___ | |_| | | | | | | | / / | ___| | _ / | |_| | | |/ / | |___ | | \ \ \_____/ |___/ |_____| |_| \_\ Press the enter key to exit.
Most of it works fine, except the way the word over appears, which is like this;
Output:
_____ _ _ _____ _____ / _ \ | | / / | ___| | _ | | | | | | / / | |___ | |_| | | | | | | | / / | ___| | _ / | |_| | | |/ / | | | | \ \_____/ |___/ |_____| |_| \_
What is causing this to happen and how can I fix it? I've tried doing this on 2 separate laptops, using Python 3.6.5 and on both the flaws are identical, so clearly it's the software, and not a problem with my laptop having trouble saving the file or something like that. EDIT: it doesn't even come out properly on here once I've posted the thread...

Thank you in advance for any help and advise you can give :).

Stephen.
Reply
#2
If you put your output in output tags, It should format properly.
Reply
#3
Thanks, but, I've tried googling it and looking in my books and I can't find any information on what an output tag is :(. What do they look like?
Reply
#4
Buran added output tag. Click on Help/Rules --> BBCode for how to use
Reply
#5
Oh, I thought you meant to type into script on python to get the block words to show up properly, sorry about that.
Reply
#6
You need to show working snippet of code for us to see what's missing.
Reply
#7
# Game Over - Version 2
# Demonstrates the use of quotes in string

print("Program 'Game Over' 2.0")

print("Same", "message", "as before")

print("Just",
      "a bit",
      "bigger")

print("Here", end=" ")
print("it is...")

[output]print(
                """
                 _____       ___       ___  ___   _____
                /  ___|     /   |     /   |/   | |  ___|
                | |        / /| |    / /|   /| | | |___
                | |  _    / ___ |   / / |__/ | | |  ___|
                | |_| |  / /  | |  / /       | | | |___
                \_____/ /_/   |_| /_/        |_| |_____|
                 _____   _     _   _____   _____
                /  _  \ | |   / / |  ___| |  _  \
                | | | | | |  / /  | |___  | |_| |
                | | | | | | / /   |  ___| |  _  /
                | |_| | | |/ /    | |___  | | \ \
                \_____/ |___/     |_____| |_|  \_\

                """
              )
[/output]

input("\n\Press the enter key to exit.")
Reply
#8
# Game Over - Version 2
# Demonstrates the use of quotes in string

print("Program 'Game Over' 2.0")

print("Same", "message", "as before")

print("Just",
      "a bit",
      "bigger")

print("Here", end=" ")
print("it is...")

print(
                r"""
                 _____       ___       ___  ___   _____
                /  ___|     /   |     /   |/   | |  ___|
                | |        / /| |    / /|   /| | | |___
                | |  _    / ___ |   / / |__/ | | |  ___|
                | |_| |  / /  | |  / /       | | | |___
                \_____/ /_/   |_| /_/        |_| |_____|
                 _____   _     _   _____   _____
                /  _  \ | |   / / |  ___| |  _  \
                | | | | | |  / /  | |___  | |_| |
                | | | | | | / /   |  ___| |  _  /
                | |_| | | |/ /    | |___  | | \ \
                \_____/ |___/     |_____| |_|  \_\

                """
              )

input("\n\Press the enter key to exit.")
Look at r""" raw string added in your print function.
This fix your escape character problem with output.
Output:
Program 'Game Over' 2.0 Same message as before Just a bit bigger Here it is... _____ ___ ___ ___ _____ / ___| / | / |/ | | ___| | | / /| | / /| /| | | |___ | | _ / ___ | / / |__/ | | | ___| | |_| | / / | | / / | | | |___ \_____/ /_/ |_| /_/ |_| |_____| _____ _ _ _____ _____ / _ \ | | / / | ___| | _ \ | | | | | | / / | |___ | |_| | | | | | | | / / | ___| | _ / | |_| | | |/ / | |___ | | \ \ \_____/ |___/ |_____| |_| \_\
Reply
#9
Worked like a charm, thank you very much.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Receiving this error in my "response" and causes script to return wrong status cubangt 18 2,088 Aug-13-2023, 12:16 AM
Last Post: cubangt
  Compiles Python code with no error but giving out no output - what's wrong with it? pythonflea 6 1,586 Mar-27-2023, 07:38 AM
Last Post: buran
  Python Pandas Syntax problem? Wrong Output, any ideas? Gbuoy 2 937 Jan-18-2023, 10:02 PM
Last Post: snippsat
  Am I wrong or is Udemy wrong? String Slicing! Mavoz 3 2,576 Nov-05-2022, 11:33 AM
Last Post: Mavoz
  Os command output in variable shows wrong value paulo79 2 1,522 Apr-09-2022, 03:48 PM
Last Post: ndc85430
  Real-Time output of server script on a client script. throwaway34 2 2,063 Oct-03-2021, 09:37 AM
Last Post: ibreeden
  things that work in terminal mode but not in sublime mode alok 4 2,897 Aug-11-2021, 07:02 PM
Last Post: snippsat
  For loops returning wrong output Nighthound21 1 1,966 May-03-2021, 03:43 AM
Last Post: deanhystad
  print function output wrong with strings. mposwal 5 3,137 Feb-12-2021, 09:04 AM
Last Post: DPaul
  Python script to summarize excel tables, then output a composite table? i'm a total n surfer349 1 2,364 Feb-05-2021, 04:37 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020