About 6,150,000 results
Open links in new tab
  1. Creating an upside down asterisk triangle in Python using for loop

    The program is supposed to ask for an input of an odd integer and then create an upside down pyramid with the first row containing the amount of asterisks as the number, and the last row …

  2. Python Programs to Print Patterns – Print Number, Pyramid, Star ...

    Sep 3, 2024 · Use the print() function in each iteration of nested for loop to display the symbol or number of a pattern (like a star (asterisk *) or number). I have created various programs that …

  3. triangle of asterisks using for loops : r/learnpython - Reddit

    Therefore we can achieve this effect with a for loop and range. For i in range(1, n): print(i*"*") We take advantage of the increasing variable to create the right triangle!

  4. Star(*) or asterisk pattern in python using for loop - CodeSpeedy

    Nested for loop is used in the program to make a star or asterisk pattern. Syntax: body of for. Output:- The outer loop gives i=0 in the first iteration and goes to the inner loop which will work …

  5. 08. How to Print a Mirrored Triangle Pattern of Asterisks in Python ...

    Dec 6, 2024 · In this tutorial, I’ll walk you through creating a mirrored triangle pattern using Python. This is a fantastic exercise for beginners to master loops, string manipulation, and …

  6. Asterisks Triangle in Python - Stack Overflow

    Nov 6, 2012 · Here's how it looks now: def triangle(): totalRows = int(eval(input("How big? "))) for currentRows in range(1,totalRows+1): for currentCol in range (1, currentRows+1): print("", end …

  7. python - Draw a triangle out of asterisks using for loops - Stack Overflow

    Feb 15, 2015 · Use (size + 1)//2 to get an integer. Because (size+1)/2 could theoretically have a fractional part, Python always returns a floating point number from it. range doesn't accept …

  8. python - Asterisk Triangle - Stack Overflow

    Mar 20, 2016 · So your Python code can be a simple for loop: for i in range(10): s = "" # concatenate to s how many spaces to align the left side of the pyramid? # concatenate to s …

  9. for loop - python asterisk triangle without using y ... - Stack Overflow

    Oct 9, 2015 · f = int(raw_input("How many rows to print in the triangle? ")) star = "*" full_string = "" for X in xrange(f): star += "**" if X>0 else "" full_string += star.center(2*f-1) + "\n" print …

  10. Triangle of asterisks in Python - Stack Overflow

    Nov 6, 2015 · I need to create a triangle with asterisk with a single function but i need to make them this way: So far I have this but I ended up in a endless loop. i = 0. x = n + 1. while i<n: …

  11. Some results have been removed
Refresh