Question

Write a python nested for loop that prints out the following pattern 100 99 98 97...

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 32 31 30 29 28 27 26 25 24 23

22 21 20 19 18 17 16 15 14 13 12 11 10

2, Write a python nested for loop that prints out the following pattern

* # * # * # * # * # * # * # * # * # * #

* # * # * # * # * # * # * # * # * #

* # * # * # * # * # * # * # * #

* # * # * # * # * # * # * #

* # * # * # * # * # * #

* # * # * # * # * #

* # * # * # * #

* # * # * #

* # * #

​​​​​​​* #

3. write a python program that calculates the total of the following serious of 100 numbers

+ 1/5 + 2/7 + 3/9 + 4/9 + . . .

4. what is the total sum of the numbers from question 3

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

Explanation:

Here are the codes for all the programs mentioned above alongwith the output attached for the run.

feel free to comment if you need any help!

1)

Code:


n = 100
for i in range(1, 14):
for j in range(i):
print(n, end=' ')
n = n-1

print()

n = 100 for i in range(1, 14): for j in range(i): print(n, end= ) n = n-1 printa

Output:

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 5

2)

Code:

for i in range(10, 0, -1):
for j in range(i):
print('*#', end=' ')

print()

for i in range(10, 0, -1): for j in range(i): print(*#, end=) printol

Output:

Press ENTER to exit console. I ... Program finished with exit code 0 * # #¥#¥ 转子 其 十 共 半 #¥#¥#¥#¥ #¥#¥#¥#¥#¥ #¥#¥#¥#¥#¥#¥ ###

3)

Code:

num = 1
den = 5
sum = 0
for i in range(100):
n = num/den
sum = sum + n
num = num + 1
den = den + 2
  
print(sum)

num = 1 den 5 Sum = @ for i in range(100): n = num den sum = sum + n num= num + 1 den den + 2 = print(sum) |

Output:

47.058 6348 6691879 ...Program finished with exit code 0 Press ENTER to exit console. I

4) The total should be 47.05

It is shown above in the output.

PLEASE UPVOTE IF YOU FOUND THIS HELPFUL!

PLEASE COMMENT IF YOU NEED ANY HELP!

Add a comment
Know the answer?
Add Answer to:
Write a python nested for loop that prints out the following pattern 100 99 98 97...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a Python program (using a nested loop) to print out the following pattern (there is...

    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

  • 5. Mark’s class just took the admission test for business school and averaged 87.05. Chapter 10...

    5. Mark’s class just took the admission test for business school and averaged 87.05. Chapter 10 Data Set 2 contains the population of scores for the 10 other classes in Mark’s university. How did Mark’s class do? Class 1 Class 2 Class 3 Class 4 Class 5 Class 6 Class 7 Class 8 Class 9 Class 10 78 81 96 85 88 78 90 79 96 86 77 78 97 90 88 82 86 93 87 89 78 93 88...

  • Write a C program to assign natural numbers 1 to 100 into a one-dimensional integer array....

    Write a C program to assign natural numbers 1 to 100 into a one-dimensional integer array. Display all the values in the array on the screen. For each number in the array, determine if the number contains digit 7 or is divisible by 7. Display all those numbers on the screen. Original array: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27...

  • python Write a Python program to construct the following pattern, using a nested for loop. *...

    python Write a Python program to construct the following pattern, using a nested for loop. * * * * * * * * * * * * * * * * * * * * * * * * * * *

  • Consider the below matrixA, which you can copy and paste directly into Matlab.

    Problem #1: Consider the below matrix A, which you can copy and paste directly into Matlab. The matrix contains 3 columns. The first column consists of Test #1 marks, the second column is Test # 2 marks, and the third column is final exam marks for a large linear algebra course. Each row represents a particular student.A = [36 45 75 81 59 73 77 73 73 65 72 78 65 55 83 73 57 78 84 31 60 83...

  • 8. The following data are scores from a Physics final administered to 34 students. 81 76...

    8. The following data are scores from a Physics final administered to 34 students. 81 76 93 99 47 67 69 72 83 88 56 62 91 94 98 63 77 84 98 75 79 67 73 65 89 86 91 85 97 73 56 92 88 83 Use the Chart below to construct a Frequency Distribution with 5 classes (15 pts) Class Tally (This column is optional.) Frequency

  • 1. Forecast demand for Year 4. a. Explain what technique you utilized to forecast your demand....

    1. Forecast demand for Year 4. a. Explain what technique you utilized to forecast your demand. b. Explain why you chose this technique over others. Year 3 Year 1 Year 2 Actual Actual Actual Forecast Forecast Forecast Demand Demand Demand Week 1 52 57 63 55 66 77 Week 2 49 58 68 69 75 65 Week 3 47 50 58 65 80 74 Week 4 60 53 58 55 78 67 57 Week 5 49 57 64 76 77...

  • Use the following collection of 30 test scores: 100, 65, 67, 61, 62, 70, 75, 73,...

    Use the following collection of 30 test scores: 100, 65, 67, 61, 62, 70, 75, 73, 88, 77, 83, 79,95, 79, 8102, 86, 87, 87, 91, 87, 89, 92, 90, 99, 87, 72, 93, 79, 52 a. Construct a frequency distribution table using 6 classes: include classes, frequencies, class marks, class boundaries, relative frequencies, and relative percentages. b. Find the mean to the nearest tenth and sample standard deviation to the nearest tenth. c. Use the results from part b...

  • Question 9-15 are based on the random sample below which is obtained to test the following hypoth...

    Question 9-15 are based on the random sample below which is obtained to test the following hypothesis about the population mean. Test the hypothesis that the mean is less than 80. 80 100 81 93 80 57 98 90 71 56 58 78 59 55 55 77 72 78 56 94 98 59 93 86 89 62 60 66 59 71 96 97 94 69 64 77 87 77 64 90 90 95 98 99 56 69 72 81 95...

  • 7. Use the following collection of 30 test scores: 100, 65, 67, 61, 62, 70, 75,...

    7. Use the following collection of 30 test scores: 100, 65, 67, 61, 62, 70, 75, 73, 88, 77, 83, 79, 95, 79, 80, 102, 86, 87, 87, 91, 87, 89, 92, 90, 99, 87, 72, 93, 79,52 a. Construct a frequency distribution table using 6 classes: include classes, frequencies, class marks, class boundaries, relative frequencies and relative percentages. b. Find the mean to the nearest tenth and sample standard deviation to the nearest tenth. c. Use the results from...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT