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

                              SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                              은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현