All our Data Science projects include bite-sized activities to test your knowledge and practice in an environment with constant feedback.
All our activities include solutions with explanations on how they work and why we chose them.
Input the number of characters in the dataset.
You should create a dictionary eye_color
with the colors as keys and their counts as values. Counts are the number of characters with that eye color.
Expected output should be a dictionary with keys as colors and values as counts.
{'brown': 3,
'blue-gray': 1,
'blue': 6,
'yellow': 2,
'red': 2,
'black': 1,
'orange': 1}
Please format the input as follows: 'brown': 6
. Pay attention to the correct use of spaces and symbols.
Please input an integer value.
Average height of all the character will be the sum of all character heights divided by the number of characters.
Create a set films_set
and store all the films directed by 'George Lucas'.
Example of expected output:
{'The Phantom Menace','Attack of the Clones',...}
Count the number of films directed by George Lucas
.
Input the name of the character with the highest weight.
Input the name of the character that is a dwarf. A dwarf is a character whose height is less than 100 cm. If there are multiple dwarfs, input the name of the first dwarf in the list.
Input the total number of distinct films.
Create a dictionary films_dict
where the film's title will be the key and the list of producers as its values.
Example of expected output:
{'Black Bird':['Gary Kurtaz','Adult Smith'],
'Return of the Jedi': ['Howard G. Kazanjian','George Lucas','Rick McCallum'],
...
}
Create a dictionary films_chron
where the keys will be the date time of the film and the values will be the titles of the films.
Example of expected output:
{
datetime.datetime(1999, 1, 19, 0, 5): 'The Phantom Menace',
datetime.datetime(2002, 1, 16, 0, 5): 'Attack of the Clones',
...
}
Create a list films
containing the title of the films. films
should contain distinct values.
Example of expected output:
['A New Hope',
'The Empire Strikes Back',
'Return of the Jedi',
'The Phantom Menace',
...
]
Create a dictionary characters_dict
where each character's name will be the key, and the list of films they appeared in will be the value.
Example of expected output:
{
'Luke Skywalker': ['A New Hope', 'The Empire Strikes Back', 'Return of the Jedi'],
'Han Solo': ['A New Hope', 'The Empire Strikes Back', 'Return of the Jedi'],
'Darth Vader': ['A New Hope', 'The Empire Strikes Back', 'Return of the Jedi', 'Revenge of the Sith'],
...
}
Create a list films_director
where each element will be a tuple containing the film title and the director's name. The list should contain distinct values.
Example of expected output:
[('A New Hope', 'George Lucas'),
('The Empire Strikes Back', 'Irvin Kershner'),
('Return of the Jedi', 'Richard Marquand'),
('The Phantom Menace', 'George Lucas'),
...
]
Create a set planets_set
which will contains the names and diameters of the planets the characters are from in the form of tuples.
Example of expected output:
{('Nal Hutta', 12150),
('Rodia', 7549),
('Stewjon', 0),
...
}
Create a set red_eyes_species
that contains the names of the species with red eyes.
Expected example of output:
{'Wookie',...}
Create a dictionary called skin_color_character
, which contains keys representing different skin colors and values as lists of names of characters who share the same skin color.
Example of expected output:
{'fair': ['Luke Skywalker', 'C-3PO', 'R2-D2', 'Leia Organa', 'Owen Lars'],
'gold': ['Darth Vader'],
'white': ['Obi-Wan Kenobi', 'Beru Whitesun lars'],
'light': ['Chewbacca', 'Han Solo', 'Jabba Desilijic Tiure'],
'green': ['Yoda'],
...
}
Create a dictionary from_planet
where the planets will be keys and the values will be the set of the character's names.
Example of expected output:
{'Eriadu': {'Wilhuff Tarkin'},
'Kashyyyk': {'Chewbacca'},
'Corellia': {'Han Solo'},
'Rodia': {'Greedo'},
'Nal Hutta': {'Jabba Desilijic Tiure'}}
Create a dictionary character_film_count
where the character's name will be the key, and the count of films they appeared in will be the value.
Example of expected output:
{
'Luke Skywalker': 4,
'Darth Vader': 3,
'Princess Leia': 3,
...
}
Create a list characters_appeared_in_all_films
that contains the names of characters who appeared in all the films.
Example of expected output:
['Luke Skywalker', 'Darth Vader']
Input the total population of all the homeworlds combined. If the population is unknown, input 0.
Create a dictionary films_producers
where the keys will be the film titles and the values will be the sets of producers.
Create a variable named average_height_mass
, which is a dictionary containing keys for males and females, and their corresponding values as the average height and mass of the characters.
Expected result should look like this:
{
'males': {'average_height': 23.484794, 'average_mass': 457.3847},
'females': {'average_height': 345.6386, 'average_mass': 45.89789}}