About 1,980,000 results
Open links in new tab
  1. Python Program to Creating an Equilateral Triangle (Pyramid

    A Python program to display the stars in an equilateral triangular form using a single for loop. It is also called the program of creating a Pyramid Pattern from Star shape.

  2. Python Program For Equilateral Triangle (With Code) - Python

    Coding an equilateral triangle involves using Python’s turtle graphics module. Write a function that takes the side length as a parameter and uses the turtle commands to draw the triangle. After defining the function, call it with the desired side length to generate the equilateral triangle.

  3. python - For/While Loops to make *-triangles - Stack Overflow

    Dec 6, 2015 · Here is how to solve both problems using only for loops. This approach is not very pythonic, but this is what you requested. Solution for single triangle problem

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

    Here's the easiest way to print this pattern: print(" "*(n-i) + "* "*i) You have to print spaces (n-i) times, where n is the number of rows and i is for the loop variable, and add it to the stars i times. Try this: k = 2*n - 2. for i in range(0, n): . for j in range(0, k): .

  5. How to Draw an Equilateral Triangle in Python - Instructables

    In this program, we will write a simple program to draw an equilateral triangle using only the ASCII character * and some array logic. Let's get started.

  6. Equilateral Triangle Pattern || for loop || Python - Help For Coders

    In this we are going to see a basic program on equilateral triangle pattern using nested for loop in Python Programming Language. Copy code for i in range(5): for j in range(5-i): print(" ", end="") for j in range(i): print(" *", end="") print("")

  7. Python Tutorial: How to Draw Equilateral Triangles in Python?

    Oct 25, 2024 · The function draw_equilateral_triangle takes one parameter, side_length, which determines the length of each side of the triangle. Inside the function, a loop runs three times, moving the turtle forward by the specified side length and then turning it left by 120 degrees.

  8. How to make a triangle using a for loop in Python

    Aug 6, 2013 · So far I have been able to create a rectangle of 1's as shown below in a 5X5. X = 0. for j in range(0, 5): . X = (X*10)+1. print(X) I would like to be able to modify this code using a for loop to be able to create a triangle like so... How would I go about doing this?

  9. How to create an equilateral triangle in Python?

    Apr 4, 2020 · How to create an equilateral triangle in Python? A Python program to display the stars in an equilateral triangular form using a single for loop. It is also called the program of creating a Pyramid Pattern from Star shape.

  10. Program to print equilateral triangle using asterisks in Python

    Oct 13, 2022 · for j in range(0, m): print(end=" ") m = m - 1 . for j in range(0, i + 1): print("*", end=' ') print() The output of the program is as follows: * * * * * * * 1. First we ask the user to enter the number of rows of the pattern. 2. Then we use nested loops to print the pattern. The nested loops take care of the rows and columns respectively. 3.

  11. Some results have been removed