I am writing a python code that should be  using recrsion that should return a boolian is two different sums are equal  the input is a list that contains small inner list with length of 2 and the first item in the small list will till for which sum the next vlaue will be added  so  the input is something like  [[a,10],[a,103],[b.20],[b,20],[a,2]]  so the first sum is the sum of all numbers that has a first item of a  and the second sum is the sum of all number that has b in the first item  how can i write a recusive function for this in python that will give me whether the both are equal or false for being not eqal

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I am writing a python code that should be  using recrsion that should return a boolian is two different sums are equal 

the input is a list that contains small inner list with length of 2 and the first item in the small list will till for which sum the next vlaue will be added 

so 

the input is something like 

[[a,10],[a,103],[b.20],[b,20],[a,2]] 

so the first sum is the sum of all numbers that has a first item of a 

and the second sum is the sum of all number that has b in the first item 

how can i write a recusive function for this in python that will give me whether the both are equal or false for being not eqal 

 

 

Expert Solution
Step 1

Recursion in Python :

A physical world model is place two equal mirrors confronting one another. Any item in the middle of them would be reflected recursively. 

In Python, we realize that a capacity can call different capacities. It is even workable for the capacity to call itself. These sorts of develop are named as recursive capacities. 

The accompanying picture shows the working of a recursive capacity called recurse. 

Our recursion closes when the number lessens to 1. This is known as the base condition. 

Each recursive capacity must have a base condition that stops the recursion or probably the capacity calls itself limitlessly. 

The Python translator restricts the profundities of recursion to help dodge unending recursions, bringing about stack floods. 

Favorable circumstances of Recursion 

  • Recursive capacities make the code look perfect and exquisite. 
  • An intricate errand can be separated into easier sub-issues utilizing recursion. 
  • Arrangement age is simpler with recursion than utilizing some settled emphasis. 

Burdens of Recursion 

  • In some cases the rationale behind recursion is difficult to finish. 
  • Recursive calls are costly (wasteful) as they take up a ton of memory and time. 
  • Recursive capacities are difficult to troubleshoot.
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education