# NAME: ARIN ARJANI # DATE: NOVEMBER 16, 2015 # CLASS: IS 115 # DURATION: # DESCRIPTION: ################################ # QUESTION 1 ################################ ################################ # PART A ################################ def addNumbers(a, b): "sums numbers in range of a and b" holder = list(range(a, b+1)) return sum(holder) #print(addNumbers(2,5)) #print("move on to part b") ################################ # PART B ################################ def multiplyNumbers(a,b): "multiplys numbers in the range of a and b" product = 1 holder = list(range(a, b+1)) for i in holder: product *=i return product #print(multiplyNumbers(1,5)) #print("move on to part c") ################################ # PART C ################################ #def acceptValues(): # ask = input("How many numbers would you like to add?") # for i in range(0, ask): # holder = list(i) # return holder WRITE OUT THE INSIDES OUSIDE A F(X) TO SEE HOW IT WORKS #acceptValues() #ask = input() #rint isinstance(ask, int) ################################ # PART D ################################ ################################ # QUESTION 2 ################################ ################################ # PART A ################################ ################################ # PART A ################################
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question