python printing clipped squaresHow can I represent an 'Enum' in Python?How to flush output of print function?Syntax error on print with Python 3Should I put #! (shebang) in Python scripts, and what form should it take?Way to create multiline comments in Python?What is the Python 3 equivalent of “python -m SimpleHTTPServer”Print multiple arguments in PythonUsing Python 3 in virtualenvWhat does “SyntaxError: Missing parentheses in call to 'print'” mean in Python?Why is “1000000000000000 in range(1000000000000001)” so fast in Python 3?

Did Pope Urban II issue the papal bull "terra nullius" in 1095?

Do you "gain" 1st level?

K-Type Thermocouple, Instrumentation Op-Amp and Arduino

What is the farthest a camera can see?

If a person claims to know anything could it be disproven by saying 'prove that we are not in a simulation'?

Why aren't rainbows blurred-out into nothing after they are produced?

Help, I cannot decide when to start the story

graphs in latex

What is the prop for Thor's hammer made of?

Sum Square Difference, which way is more Pythonic?

How much can I judge a company based on a phone screening?

Shifting tenses in the middle of narration

Is it possible to know the exact chord from the roman numerals

Will using a resistor in series with a LED to control its voltage increase the total energy expenditure?

Units of measurement, especially length, when body parts vary in size among races

Is there a way to proportionalize fixed costs in a MILP?

How do I call a 6-digit Australian phone number with a US-based mobile phone?

Good textbook for queueing theory and performance modeling

Scam? Phone call from "Department of Social Security" asking me to call back

Does fossil fuels use since 1990 account for half of all the fossil fuels used in history?

What should we do with manuals from the 80s?

Random Stripe Webhook Issues

Bringing Power Supplies on Plane?

Should I leave building the database for the end?



python printing clipped squares


How can I represent an 'Enum' in Python?How to flush output of print function?Syntax error on print with Python 3Should I put #! (shebang) in Python scripts, and what form should it take?Way to create multiline comments in Python?What is the Python 3 equivalent of “python -m SimpleHTTPServer”Print multiple arguments in PythonUsing Python 3 in virtualenvWhat does “SyntaxError: Missing parentheses in call to 'print'” mean in Python?Why is “1000000000000000 in range(1000000000000001)” so fast in Python 3?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















the python code is printing this



___
____
____
____
_


instead of this



____
____
____
____


this is the code some of it doesn't do anything because it has been commented out so just ignore the associated variables



X = 0 #majic number 
L = 0 #lines
i = 0 #list intilising varble thing

x = 175 #cordinates are x and y
y = 0 #dont set x&y above 175
Del = x + 1
X = y*176
x = x+X
stuff = []
for L in range(0,7):
for i in range(0,7):
i + 1
stuff.insert(i,"_")



stuff.insert(i,"n")
i + 1
'''stuff.pop(Del)
stuff.insert(x,"q")'''
print(*stuff, sep='')


in the current settings it supposed to print a 8*8 board. i have fiddled around with the position of the i + 1 but it didn't seem to make a difference.
if someone knows how to get in a alternating pattern that would be great.
when i did that i just got abbbbaaa. i should of mentioned this early but the end goal is to create a game of chess in the terminal.










share|improve this question
































    1















    the python code is printing this



    ___
    ____
    ____
    ____
    _


    instead of this



    ____
    ____
    ____
    ____


    this is the code some of it doesn't do anything because it has been commented out so just ignore the associated variables



    X = 0 #majic number 
    L = 0 #lines
    i = 0 #list intilising varble thing

    x = 175 #cordinates are x and y
    y = 0 #dont set x&y above 175
    Del = x + 1
    X = y*176
    x = x+X
    stuff = []
    for L in range(0,7):
    for i in range(0,7):
    i + 1
    stuff.insert(i,"_")



    stuff.insert(i,"n")
    i + 1
    '''stuff.pop(Del)
    stuff.insert(x,"q")'''
    print(*stuff, sep='')


    in the current settings it supposed to print a 8*8 board. i have fiddled around with the position of the i + 1 but it didn't seem to make a difference.
    if someone knows how to get in a alternating pattern that would be great.
    when i did that i just got abbbbaaa. i should of mentioned this early but the end goal is to create a game of chess in the terminal.










    share|improve this question




























      1












      1








      1








      the python code is printing this



      ___
      ____
      ____
      ____
      _


      instead of this



      ____
      ____
      ____
      ____


      this is the code some of it doesn't do anything because it has been commented out so just ignore the associated variables



      X = 0 #majic number 
      L = 0 #lines
      i = 0 #list intilising varble thing

      x = 175 #cordinates are x and y
      y = 0 #dont set x&y above 175
      Del = x + 1
      X = y*176
      x = x+X
      stuff = []
      for L in range(0,7):
      for i in range(0,7):
      i + 1
      stuff.insert(i,"_")



      stuff.insert(i,"n")
      i + 1
      '''stuff.pop(Del)
      stuff.insert(x,"q")'''
      print(*stuff, sep='')


      in the current settings it supposed to print a 8*8 board. i have fiddled around with the position of the i + 1 but it didn't seem to make a difference.
      if someone knows how to get in a alternating pattern that would be great.
      when i did that i just got abbbbaaa. i should of mentioned this early but the end goal is to create a game of chess in the terminal.










      share|improve this question
















      the python code is printing this



      ___
      ____
      ____
      ____
      _


      instead of this



      ____
      ____
      ____
      ____


      this is the code some of it doesn't do anything because it has been commented out so just ignore the associated variables



      X = 0 #majic number 
      L = 0 #lines
      i = 0 #list intilising varble thing

      x = 175 #cordinates are x and y
      y = 0 #dont set x&y above 175
      Del = x + 1
      X = y*176
      x = x+X
      stuff = []
      for L in range(0,7):
      for i in range(0,7):
      i + 1
      stuff.insert(i,"_")



      stuff.insert(i,"n")
      i + 1
      '''stuff.pop(Del)
      stuff.insert(x,"q")'''
      print(*stuff, sep='')


      in the current settings it supposed to print a 8*8 board. i have fiddled around with the position of the i + 1 but it didn't seem to make a difference.
      if someone knows how to get in a alternating pattern that would be great.
      when i did that i just got abbbbaaa. i should of mentioned this early but the end goal is to create a game of chess in the terminal.







      python-3.x






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 27 at 11:21







      Snowball

















      asked Mar 27 at 9:59









      SnowballSnowball

      63 bronze badges




      63 bronze badges

























          2 Answers
          2






          active

          oldest

          votes


















          0














          Just use the increminting operator '+='. i + 1 means nothing in your code and wont have any effect if you removed it. It should be as follows:



          for L in range(0,7):
          for i in range(0,7):
          i += 1
          stuff.insert(i,"_")



          stuff.insert(i,"n")





          share|improve this answer
































            0














            for works very differently in Python than it does in, say, C.

            Also, in Python, you only very rarely need to use indices, especially since using iterators is more efficient.



            I think you were trying to achieve this with your example:



            #!/usr/bin/env python3
            x = 3
            y = 2
            stuff = []
            for L in range(y):
            for i in range(x):
            stuff.append('_')
            stuff.append('n')
            # the list now looks like this:
            # stuff = ['_', '_', '_', 'n', '_', '_', '_', 'n']
            # It contains y*x strings, each length 1.
            # This is something like "char **stuff" in C.
            output = ''.join(stuff) # this creates '___n___n'
            print(output)


            Note that the variables i and L are actually never used, we are just using the number of items represented by each range to iterate over.



            Or if you don't care about the strings being stored in a list and just want to print the rectangle:



            #!/usr/bin/env python3
            x = 3
            y = 2
            for L in range(y):
            print('_' * x) # by default, print appends 'n' to the end.


            '_' * x just repeats the string '_' x times, creating another string, '___'






            share|improve this answer





























              Your Answer






              StackExchange.ifUsing("editor", function ()
              StackExchange.using("externalEditor", function ()
              StackExchange.using("snippets", function ()
              StackExchange.snippets.init();
              );
              );
              , "code-snippets");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "1"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55374408%2fpython-printing-clipped-squares%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              Just use the increminting operator '+='. i + 1 means nothing in your code and wont have any effect if you removed it. It should be as follows:



              for L in range(0,7):
              for i in range(0,7):
              i += 1
              stuff.insert(i,"_")



              stuff.insert(i,"n")





              share|improve this answer





























                0














                Just use the increminting operator '+='. i + 1 means nothing in your code and wont have any effect if you removed it. It should be as follows:



                for L in range(0,7):
                for i in range(0,7):
                i += 1
                stuff.insert(i,"_")



                stuff.insert(i,"n")





                share|improve this answer



























                  0












                  0








                  0







                  Just use the increminting operator '+='. i + 1 means nothing in your code and wont have any effect if you removed it. It should be as follows:



                  for L in range(0,7):
                  for i in range(0,7):
                  i += 1
                  stuff.insert(i,"_")



                  stuff.insert(i,"n")





                  share|improve this answer













                  Just use the increminting operator '+='. i + 1 means nothing in your code and wont have any effect if you removed it. It should be as follows:



                  for L in range(0,7):
                  for i in range(0,7):
                  i += 1
                  stuff.insert(i,"_")



                  stuff.insert(i,"n")






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 27 at 11:34









                  Ahmed HawaryAhmed Hawary

                  1119 bronze badges




                  1119 bronze badges


























                      0














                      for works very differently in Python than it does in, say, C.

                      Also, in Python, you only very rarely need to use indices, especially since using iterators is more efficient.



                      I think you were trying to achieve this with your example:



                      #!/usr/bin/env python3
                      x = 3
                      y = 2
                      stuff = []
                      for L in range(y):
                      for i in range(x):
                      stuff.append('_')
                      stuff.append('n')
                      # the list now looks like this:
                      # stuff = ['_', '_', '_', 'n', '_', '_', '_', 'n']
                      # It contains y*x strings, each length 1.
                      # This is something like "char **stuff" in C.
                      output = ''.join(stuff) # this creates '___n___n'
                      print(output)


                      Note that the variables i and L are actually never used, we are just using the number of items represented by each range to iterate over.



                      Or if you don't care about the strings being stored in a list and just want to print the rectangle:



                      #!/usr/bin/env python3
                      x = 3
                      y = 2
                      for L in range(y):
                      print('_' * x) # by default, print appends 'n' to the end.


                      '_' * x just repeats the string '_' x times, creating another string, '___'






                      share|improve this answer































                        0














                        for works very differently in Python than it does in, say, C.

                        Also, in Python, you only very rarely need to use indices, especially since using iterators is more efficient.



                        I think you were trying to achieve this with your example:



                        #!/usr/bin/env python3
                        x = 3
                        y = 2
                        stuff = []
                        for L in range(y):
                        for i in range(x):
                        stuff.append('_')
                        stuff.append('n')
                        # the list now looks like this:
                        # stuff = ['_', '_', '_', 'n', '_', '_', '_', 'n']
                        # It contains y*x strings, each length 1.
                        # This is something like "char **stuff" in C.
                        output = ''.join(stuff) # this creates '___n___n'
                        print(output)


                        Note that the variables i and L are actually never used, we are just using the number of items represented by each range to iterate over.



                        Or if you don't care about the strings being stored in a list and just want to print the rectangle:



                        #!/usr/bin/env python3
                        x = 3
                        y = 2
                        for L in range(y):
                        print('_' * x) # by default, print appends 'n' to the end.


                        '_' * x just repeats the string '_' x times, creating another string, '___'






                        share|improve this answer





























                          0












                          0








                          0







                          for works very differently in Python than it does in, say, C.

                          Also, in Python, you only very rarely need to use indices, especially since using iterators is more efficient.



                          I think you were trying to achieve this with your example:



                          #!/usr/bin/env python3
                          x = 3
                          y = 2
                          stuff = []
                          for L in range(y):
                          for i in range(x):
                          stuff.append('_')
                          stuff.append('n')
                          # the list now looks like this:
                          # stuff = ['_', '_', '_', 'n', '_', '_', '_', 'n']
                          # It contains y*x strings, each length 1.
                          # This is something like "char **stuff" in C.
                          output = ''.join(stuff) # this creates '___n___n'
                          print(output)


                          Note that the variables i and L are actually never used, we are just using the number of items represented by each range to iterate over.



                          Or if you don't care about the strings being stored in a list and just want to print the rectangle:



                          #!/usr/bin/env python3
                          x = 3
                          y = 2
                          for L in range(y):
                          print('_' * x) # by default, print appends 'n' to the end.


                          '_' * x just repeats the string '_' x times, creating another string, '___'






                          share|improve this answer















                          for works very differently in Python than it does in, say, C.

                          Also, in Python, you only very rarely need to use indices, especially since using iterators is more efficient.



                          I think you were trying to achieve this with your example:



                          #!/usr/bin/env python3
                          x = 3
                          y = 2
                          stuff = []
                          for L in range(y):
                          for i in range(x):
                          stuff.append('_')
                          stuff.append('n')
                          # the list now looks like this:
                          # stuff = ['_', '_', '_', 'n', '_', '_', '_', 'n']
                          # It contains y*x strings, each length 1.
                          # This is something like "char **stuff" in C.
                          output = ''.join(stuff) # this creates '___n___n'
                          print(output)


                          Note that the variables i and L are actually never used, we are just using the number of items represented by each range to iterate over.



                          Or if you don't care about the strings being stored in a list and just want to print the rectangle:



                          #!/usr/bin/env python3
                          x = 3
                          y = 2
                          for L in range(y):
                          print('_' * x) # by default, print appends 'n' to the end.


                          '_' * x just repeats the string '_' x times, creating another string, '___'







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Mar 27 at 12:51

























                          answered Mar 27 at 12:38









                          mossymountainmossymountain

                          1036 bronze badges




                          1036 bronze badges






























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55374408%2fpython-printing-clipped-squares%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                              Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                              Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript