keepTabs (actions: list[str]) -> dict[str, int] that take as input a list of actions (an action log book) and returns a dictionary storing the karma points of all the characters mentioned in actions. People with zero net karma points will be removed from the dictionary before the function returns. Each entry of actions comes in one of the following two forms: • a name (a sequence of English letters without any punctuation marks or spaces) followed by ei- ther++or--, indicating positive karma and negative karma, respectively. For example, "Jack++" or "Kanat--". The names are case-sensitive and may appear in mixed upper- and lower- cases. • a name followed by -> then another name, indicating a transfer of all karma points from the first person to the second. For example, "Abby->Jeff" means Abby gives all her karma points to Jeff. That is, Jeff inherits all karma points of Abby, be it negative or positive. After that, Abby's karma point resets to 0. We guarantee that there will not be extra spaces or any irrelevant punctuation marks anywhere.

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

python code

keepTabs (actions: list[str]) -> dict[str, int]
that take as input a list of actions (an action log book) and returns a dictionary storing the karma points
of all the characters mentioned in actions. People with zero net karma points will be removed from
the dictionary before the function returns.
Each entry of actions comes in one of the following two forms:
• a name (a sequence of English letters without any punctuation marks or spaces) followed by ei-
ther ++ or --, indicating positive karma and negative karma, respectively. For example, "Jack++"
or "Kanat --". The names are case-sensitive and may appear in mixed upper- and lower- cases.
• a name followed by -> then another name, indicating a transfer of all karma points from the first
person to the second. For example, "Abby->Jeff" means Abby gives all her karma points to
Jeff. That is, Jeff inherits all karma points of Abby, be it negative or positive. After that, Abby's
karma point resets to 0.
We guarantee that there will not be extra spaces or any irrelevant punctuation marks anywhere.
Transcribed Image Text:keepTabs (actions: list[str]) -> dict[str, int] that take as input a list of actions (an action log book) and returns a dictionary storing the karma points of all the characters mentioned in actions. People with zero net karma points will be removed from the dictionary before the function returns. Each entry of actions comes in one of the following two forms: • a name (a sequence of English letters without any punctuation marks or spaces) followed by ei- ther ++ or --, indicating positive karma and negative karma, respectively. For example, "Jack++" or "Kanat --". The names are case-sensitive and may appear in mixed upper- and lower- cases. • a name followed by -> then another name, indicating a transfer of all karma points from the first person to the second. For example, "Abby->Jeff" means Abby gives all her karma points to Jeff. That is, Jeff inherits all karma points of Abby, be it negative or positive. After that, Abby's karma point resets to 0. We guarantee that there will not be extra spaces or any irrelevant punctuation marks anywhere.
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Linked List Representation
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.
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