Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

For Python 3 Write a Python program that prompts the user for an integer (positive). Use a loop to print 1 to the number entered.

For Python 3

Write a Python program that prompts the user for an integer (positive). Use a loop to print 1 to the number entered. The numbers should appear on the same line separated by spaces. On the next line print the sum of the numbers printed on the previous line. Do not use the built-in sum function or a formula. Find the sum using the same loop you use to print the numbers. See the sample runs for clarification. Sample Run1

Enter a positive integer: 1 1 The sum is 1. 

Sample Run 2

Enter a positive integer: 13 1 2 3 4 5 6 7 8 9 10 11 12 13 The sum is 91. 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions