Answer:
here is the program you need:
for i in range(10):
if i<=4:
for j in range(i+1):
print('*', end='')
else:
for j in range(10 - i-1):
print('*', end='')
print()
Output:
Hope you like it!
PLease provide comments if you have any doubts!
python Write a Python program to construct the following pattern, using a nested for loop. *...
Write a Python program (using a nested loop) to print out the following pattern (there is a space between the numbers next to each other). 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1
Java Write a program in Java using “Nested For Loop” to print following pattern. AAA AAA C566 AAA C566 AAA AAA C566 AAA AAA AAA C566 AAA AAA AAA
Write a python nested for loop that prints out the following pattern 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33...
Turtle Graphics with nested loop: Write a turtle graphics python program repeat_squares.py that uses nested loops to draw 100 squares, to create this design: Turtle-squares.png starting with the smallest square in the bottom right-hand corner. Start at position (-4,4). At each step increase the length of each side by 4 pixels. Draw 100 squares. Please submit with an animation speed of 0 and the turtle hidden turtle.hideturtle()
Using python, create a program using nested loops to write a function called substring(s,b) that returns True or False depending on whether or not b is a substring of s. For example: String: "Diamond" Substring: "mond" The code will then state that this is true and "mond" is a substring of "Diamond". Example of what the program should output: Enter string: Tree Enter substring: Tre Yes, 'Tre' is a substring of 'Tree' Limitation: This program cannot use "find()" and "in"...
Programming in C: Using a nested for loop create the pattern below. Prompt the user for the height (number of rows) and width (number of characters per line) for pattern A. You may use any number for height and width, just as long as the basic pattern is preserved. Call a function to print the pattern. This function receives the height and width as inputs (parameters) but does not return a value. Make use of an if structure to instruct...
Write a java program that will print out the following patters. Use nested for loop.101101010110101
Using a nested for loop create a pattern that looks like 1* on line1 and 4 *s on line2 and 1* on line3 and 4*s on line 4. C++
Write them in python IDLE ***** 5. Average Rainfall Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program should first ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate twelve times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month. After all iterations,...
How can I following questions by using nested for loop in Python 3? Q1. ----1 ---2- --3-- -4--- 5---- Q2 -----1----- ----333---- ---55555--- --7777777-- -999999999-