Python Project: Please Review

I would really like to get some reviews on my simpler pieces of code. The one below is GLI python:

import time
ShipName = "Ieniadas II"
Captain = "Adeline Fuller"
Location = "Ienia"
Password = "!£$%^IJHgfde456uHGFR%^&8iuy545678YTGHJ(*&^%thgfrtyu"
PasswordAttempt = input("Ship Password: ")
while PasswordAttempt != Password:
	print("Incorrect password")
	PasswordAttempt = input("Ship Password: ")
print ("Password correct. Welcome aboard the", ShipName + ".")
print("\nThe spaceship", ShipName, "is currently at", Location + ".")
Choice = ""
while Choice != "d":
	print ("\nWhat would you like to do", Captain + "?\n")
	print ("a. Travel to another planet")
	print ("b. Fire cannons")
	print ("c. See details")
	print ("d. Exit\n")
	Choice = input ("Enter your choice:  ")
	if Choice == "a":
		Location = input ("Where would you like to go? ")
		print ("\nTravelling...")
		print (ShipName, "has arrived at", Location + ".")
	elif Choice == "b":
		print ("\nFiring cannons...")
		print ("\nBANG!")
	elif Choice == "c":
		print ("\nShip name:", ShipName)
		print ("Capain:", Captain)
		print ("Location:", Location)
		Details = input ("\nDo you want to change these detaials (y/n)? ")
		if Details == "y":
			print ("\nWhich details do you want to change?\n")
			print ("a. Ship name")
			print ("b. Captain")
			print ("c. Location")
			DetailsChoice = input ("\nEnter your choice: ")
			if DetailsChoice == "a":
				ShipName = input ("What do you want your ship's name to be? ")
			elif DetailsChoice == "b":
				Captain = input ("What do you want your captain's name to be? ")
			elif DetailsChoice == "c":
				Location == input ("What do you want your loction's name to be? ")
				print ("Invalid command. Please enter 'a','b' or 'c'.")
		elif Details == "No":
			print ("Okay")
			print ("Invalid command. Please enter 'y' or 'n'.")
	elif Choice == "d":
		print ("Goodbye")
		print ("Invalid command. Please enter 'a','b','c' or 'd'.")

Thanks for your time. :grinning:

1 Like

Well done on completing the project, looks great! :clap:

Just a couple minor bits of feedback if you don’t mind:

  • It’s standard practice per PEP-8 (the Python style guide) to use snake case for all variable names, this is all lowercase with words separated by underscores, so password_attempt or ship_name instead of PasswordAttempt/ShipName. There’s nothing wrong with doing it any other way per se (and consistency is the really key thing) but it’s generally better to follow the recommended practices

  • This is extremely picky, but I think this should be “n” instead of “No” to follow the (y/n) format given by the instructions:

Happy coding! :slight_smile:

@notlyall I totally didn’t realize that I had typed ‘No’ instead of ‘n’ thanks for pointing it out. And thanks for the information about the standard practice as I didn’t know about that. Thanks for taking your time to review it. :grinning:

1 Like

Good job! I really like that you focus on readability. Beside following PEP you could also focus on formatting. To further improve your formatting, I recommend using black. You can read about how to install and use it on their documentation (Black 22.1.0 documentation)

A friend of mine is doing a personal project and it isn’t working can please review?

import statistics
import math
import sys
import time
def sort_list (list):
min = list[0]
max = list[-1]

def find_quartile1 (list):
len2 = len(list) / 2
if len2 % 2 != 0:
len2 = math.ceil(len2)
list2 = list[0: len2]
return list2
def find_quartile2 (list):
len2 = len(list) / 2
if len2 % 2 != 0:
len2 = math.ceil(len2)
len2 = len2
list3 = list[len2: -1]
return list3
def find_IQR1 (quartile1):
def find_IQR2 (quartile2):
def find_ans (list):
print(‘quartile range 1:’)
print(“Quartile 1:”)
print(‘quartile range 3:’)
print(“Quartile 3:”)
choice = input(“Would you like to use the console to input a list? (Y/N)”)
if choice == ‘Y’:
lst =

number of elements as input

n = int(input("Enter number of elements : "))

iterating till the range

for i in range(0, n):
ele = int(input())

  lst.append(ele) # adding the element

print(lst) #Credit to Python | Get a list as input from user - GeeksforGeeks for user list input syntax
choice2 = input(“Is this correct? (Y/N)”)
if choice2 == “Y”:
print(“restart program”)
elif choice == ‘N’:
print(“Now use the code window. Pause the code. When you are finished, reload the program.”)
lst =
print(“Invalid Choice”)
exit() #end the program


If you’re looking for help on something feel free to make a new topic in the appropriate category making sure to follow this guide: :slight_smile:

thank you for the help

1 Like