Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using python. Could you help me solve the problem Thanks! Write a function onesum which takes one input, n, and finds the sum: 111+111+1111+up to

Using python. Could you help me solve the problem Thanks!

image text in transcribed

Write a function onesum which takes one input, n, and finds the sum: 111+111+1111+up to n digits of 1 For example: Question 4 Incorrect Mark 0.00 out of 1.00 print (onesum( 1) r Flag question Which is 1-1 >print (onesum( 2)) 12 Which is 1 +11-12 >>>print (oneSum( 3)) 123 Which is 1 +11+ 111 123. Hint: think about each element of the sum (1,11, 111, for example) represented as a sum of powers of 10: 111 10A0+10A1+10A2 1+10+100 Answer: (penalty regime 0 %) 1def oneSum(n): um e temp1 for num in range (1,n temp temp 10+1 umsum+temp print temp) return sum Check Syntax Error(s) Sorry: IndentationError: expected an indented block (prog.python3, line 6) Incorrect Marks for this submission: 0.00/1.00

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions