About 61,200 results
Open links in new tab
  1. How to make a triangle of x's in python? - Stack Overflow

    Dude It's super easy: def triangle(n): for i in range(1, n +1): print ' ' * (n - i) + 'x' * i Or even: def triangle(n): for i in range(1, n +1): print ('x' * i).rjust(n, ' ') output for triangle(5): x xx xxx xxxx …

  2. Making triangles in Python - Stack Overflow

    Sep 18, 2018 · If you are learning Python in 2018, you should definitely be targeting the currently recommended and supported version of the language, which is Python 3. Version 2 was …

  3. python - How to draw a right angle triangle using tkinter ... - Stack ...

    Oct 5, 2020 · I'm trying to draw a right angle triangle with tkinter. I can't figure out how to do it, I can do a rectangle and then another one but I cant get the second rectangle to be a triangle.

  4. python - Program, that creates triangle and square - Stack Overflow

    Nov 7, 2018 · I've started learning programming and I need to create program, where user can enter amount of rows wanted and then program has to print two different shapes according to …

  5. How to print a Triangle Pyramid pattern using a for loop in Python ...

    Try this: def triangle(n): k = 2*n - 2 for i in range(0, n): for j in range(0, k): print(end=" ") k = k - 1 for j in range(0, i+1): print("* ", end="") print("\r") n = 5 triangle(n) Description: The 1st line …

  6. Nested loop code to create right triangle in Python

    Dec 29, 2016 · Professor gave us a simple code that executes a square and we need to add/change the code to output the right triangle shape as shown below. It's just a simple loop …

  7. Pascal's Triangle for Python - Stack Overflow

    Jun 7, 2014 · As a learning experience for Python, I am trying to code my own version of Pascal's triangle. It took me a few hours (as I am just starting), but I came out with this code: …

  8. How to Draw a triangle shape in python? - Stack Overflow

    Apr 22, 2014 · I want to draw the shape of a triangle using python. I have already drawn the shape of circle but I cannot draw the triangle. Could someone please help me with this? This is …

  9. python 3.x - How to draw a triangle using matplotlib.pyplot based …

    Jun 6, 2017 · I would like to draw a triangle using python3 module matplotlib. import numpy as np import matplotlib.pyplot as plt X_train = np.array([[1,1], [2,2.5], [3, 1], [8, 7. ...

  10. Drawing a right triangle (Python 3) - Stack Overflow

    Mar 30, 2017 · I'm having a bit of an issue. I'm trying to make this program output a right triangle based on the height and symbol that is specified by the user, but whenever I enter the symbol …

Refresh