Question: 1. Write functions and necessary testing code for the following functions: o sumn(n) returns the sum of the first n natural numbers o sumNCubes (n))

1. Write functions and necessary testing code for the following functions: o sumn(n) returns the sum of the first n natural numbers o sumNCubes (n)) returns the sum of the cubes of the first n natural numbers 


2. Use these functions in a program that prompts the user for an n and prints out the corresponding function values. Notice - the functions RETURN values....they don't PRINT values. 


3. Write and test a function (sumList (nums) that returns the sum of the numbers in the nums list. 


4. Functions can call others functions. For this applications, you will write three functions. The purpose of this application is to calculate a bank balance based on a list of transactions. You will have a dictionary of lists like the following: bank = {'Account1':[900, 4, 75, -40, -35, 800], ['Account2':[1535, 3, -500, 450, -875]} The format of the value for the key/value pairs in the dictionary is , , main () - this is the start of your application. traverseAccounts(dictionary) - should loop through the dictionary obtaining the value for each account and displaying the account name and current value. calculateValue(accountList) - should calculate the current account balance using the information in the list

Step by Step Solution

3.37 Rating (141 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

heres a Python implementation addressing your requirements Task 1 Functions to Calculate Sum of Firs... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!