Exploring the Star Wars universe with Python
Exploring the Star Wars universe with Python Data Science Project
Python Collections

Exploring the Star Wars universe with Python

In this project we'll explore the fascinating universe of Star Wars and we'll put to practice all the Python Collection skills like List, Dictinonary and Tuple management, iteration, reshaping and data transformation. You'll need to answer questions using just iteration of nested collections, reshape the original collections into different forms and combine nested structures.
Start this project
Exploring the Star Wars universe with PythonExploring the Star Wars universe with Python
Project Created by

Anurag Verma

Project Activities

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

How many Star Wars characters are in the `dataset`

Input the number of characters in the dataset.

codevalidated

Find the eye color of the characters and their counts.

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}
input

What is the most predominant eye_color among all characters, and what is its count

Please format the input as follows: 'brown': 6. Pay attention to the correct use of spaces and symbols.

input

How many female characters are listed?

Please input an integer value.

input

What is the average `height` of all characters?

Average height of all the character will be the sum of all character heights divided by the number of characters.

codevalidated

Find the films directed by `George Lucas`?

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',...}

multiplechoice

How many films were directed by `George Lucas` in total?

Count the number of films directed by George Lucas.

input

Provide the name of the character who possesses the highest weight among all the characters

Input the name of the character with the highest weight.

input

Name of the character that is a dwarf

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

Total number of distinct films

Input the total number of distinct films.

codevalidated

Films that were produced by more than one person?

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'],
  ...
}
codevalidated

Films in chronological Order

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',
 ...
 }
codevalidated

Create a list `films` containing the title of the films

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',
  ...
  ]
codevalidated

Which characters appeared in multiple films?

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'],
    ...
}

codevalidated

Films and their director name

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'),
 ...
 ]
codevalidated

Characters homeworld and it's size

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),
 ...
 }

codevalidated

Star Wars species with red eyes

Create a set red_eyes_species that contains the names of the species with red eyes.

Expected example of output:

{'Wookie',...}
codevalidated

Characters sharing the same skin color

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'],
  ...
}
codevalidated

Find the characters from the same planet

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'}}
codevalidated

Characters that have appeared in the highest number of films, along with the frequency of their appearances in each film

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,
    ...
}
codevalidated

Which characters have appeared in all films?

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

What is the total population of all the homeworlds combined?

Input the total population of all the homeworlds combined. If the population is unknown, input 0.

codevalidated

Films and Their Producers

Create a dictionary films_producers where the keys will be the film titles and the values will be the sets of producers.

codevalidated

Average height and mass of male and female characters separately

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}}
Exploring the Star Wars universe with PythonExploring the Star Wars universe with Python
Project Created by

Anurag Verma

What's up, friends! 👋 I'm a computer science student about to finish my last year of college. 🎓 I LOVE writing code! ❤️ It makes me so happy! 😄 Whether I'm goofing in notebooks 📓 or coding in Python 🐍, writing programs is a blast! 💥

What's up, friends! 👋 I'm a computer science student about to finish my last year of college. 🎓 I LOVE writing code! ❤️ It makes me so happy! 😄 Whether I'm goofing in notebooks 📓 or coding in Python 🐍, writing programs is a blast! 💥

This project is part of

Python Collections

Explore other projects