subject

Below we've attempted to write a recursive formula that will calculate the nth triangular number. 1 def tri(n): return n + tri(n - 1) what will be the current result of using this function? it will correctly calculate the nth triangular number oit will instead calculate the n 1th triangular number. it will instead calculate the n +1th triangular number. o it will cause a runtimeerror due to infinite recursion. it will cause a nameerror due to attempting to call try) from within try problem 5.2.2, part 2 of 3 1.0/1.0 point (graded) why does the issue or error in the problem above occur? o no issue occurs; the function correctly calculates the nth triangular number. o the recursive function has no base case, so it never stops calling copies of itself. o the recursive function has no base case, so it never calls a copy of itself. othe recursive function incorrectly calls itself with n -1 as an argument instead of n o the recursive function incorrectly calls itself with n 1 as an argument instead of n1. othe variable n - 1 is not defined when referenced on line 2 which of the following revisions to the function tri) would fix the observed issues? no revision necessary; the original function works. 1| def tri(n): if n == 1: return 1 4else: 5 l return n tri (n-1) 1| def tri(n): 2 if n return n +tri(n-1) 4lse: return 1 1| def tri(n): if n > 1 return 1 4lse return n + tri(n-1) 1| def tri(n): 21f n> 1: return n tri(n-1) 4 else: return1

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 23:30
You picked the corridor which led you here. if the guards find you, they're going to be really angry! what is the synonym of angry
Answers: 1
question
Computers and Technology, 22.06.2019 14:30
Hi plz 11 ! when planning a table, what step comes first: "define the column headers" or "calculate the number of columns/rows"? a. calculate the number of columns/rows b. define the column headers
Answers: 1
question
Computers and Technology, 22.06.2019 23:50
List a few alternative options and input and output over the standerd keyboard and monitor. explain their functioning in details.
Answers: 2
question
Computers and Technology, 23.06.2019 15:10
What role did women fill during world war ii?
Answers: 1
You know the right answer?
Below we've attempted to write a recursive formula that will calculate the nth triangular number. 1...
Questions
question
Mathematics, 25.09.2020 01:01
question
Mathematics, 25.09.2020 01:01
question
Mathematics, 25.09.2020 01:01
question
Biology, 25.09.2020 01:01
Questions on the website: 13722363