Question: exercise 4 and 5 please ! Markdown Python 3 13 Exercise-4: Sum all even numbers from 1 to n , where n is even and
Markdown Python 3 13 Exercise-4: Sum all even numbers from 1 to n , where n is even and given as input by the user. What happens if the user enters an odd value for n? (answer in the comments of your code) 2 + 4 + 6 + ... + Exercise-5 Ask the user for the size of a square matrix. Since the matrix is square, the number of rows will equal the number of columns. Your code will then ful in (and print out the upper triangle of the matrix using a for loop structure you design. The data filed (printed) in the matrix will be the counting integers, and only in the upper triangle of the matrix, Examples of a 3x3 and a 5x5 matrix are provided below. Your code will prompt the user for the size, and adapt to the size entered 1 2 3 0 4 5 0 0 6 4 8 7 1 2 3 5 0 6 9 0 0 10 11 12 0 0 0 13 14 0 0 0 0 15 Hint: If you struggle with this task, then, in a first attempt fill the entire array with increasing Integer numbers, once you have accomplished that task, you might have a better idea on how to solve the task in this problem Mode Command Ln 1, Col1 Laboynb Saving completed ja/ P E tv z
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
