How to write a function in Phython that take two numbers x and y and returns the sum of numbers from x to y Code that does not work: def main(): first_number = int(input("Enter x: ")) # the input()...


How to write a function in Phython that take two numbers x and y and returns the sum of numbers from x to y


Code that does not work:


def main():


first_number = int(input("Enter x: "))  # the input() function returns a string;


second_number = int(input("Enter y: "))


print(sum_between(x, y))



def sum_between(x, y):


    nums_between = range(x, y + 1)


    return sum(nums_between)


main()



Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here