Skip to content

Instantly share code, notes, and snippets.

@CodeByLine
Forked from wynand1004/star_trek_captains.py
Created December 30, 2017 02:45
Show Gist options
  • Save CodeByLine/4b10f52415fb7ef6aee5567098908358 to your computer and use it in GitHub Desktop.
Save CodeByLine/4b10f52415fb7ef6aee5567098908358 to your computer and use it in GitHub Desktop.
A simple introduction / practice exercise to learn a little about Python lists.
import os
os.system("clear")
print("""
__ ___
(_ |_ _ _ | _ _|
__)|_(_|| || (-|(
""")
# 1) Create a list called captains and add the following names to it:
# Archer, Kirk, Decker, Kirk, Picard, Janeway
# print the list
print("1)")
delay = input("Please press enter to continue. > ")
# 2) Add Sisko to the end of the list
# print the list
print("\n2)")
delay = input("Please press enter to continue. > ")
# 3) Insert Garrett after Kirk and before Picard
# print the list
print("\n3)")
delay = input("Please press enter to continue. > ")
# 4) Remove Decker from the list
# print the list
print("\n4)")
delay = input("Please press enter to continue. > ")
# 5) print how many captains are on the list - count Kirk twice.
print("\n5)")
delay = input("Please press enter to continue. > ")
# 6) Ask the user for the name of a captain.
# If the captain is on the list print "NAME is on the list."
# If not, print"NAME is not on the list."
print("\n6)")
delay = input("Please press enter to continue. > ")
# 7) print how many times Kirk is on the list.
print("\n7)")
delay = input("Please press enter to continue. > ")
# 8) print the index of Picard on the list
print("\n8)")
delay = input("Please press enter to continue. > ")
# 9) Sort the list in alphabetical order
# print the list
print("\n9)")
delay = input("Please press enter to continue. > ")
# 10) print the names one by one on a separate line like so:
# NAME is a Star Trek captain.
print("\n10)")
delay = input("Please press enter to continue. > ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment