Python Forum
click menu option 6 it does not print out what I need it to - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: click menu option 6 it does not print out what I need it to (/thread-6445.html)



click menu option 6 it does not print out what I need it to - AMRiley23 - Nov-22-2017

I am having trouble with writing the code in python I need help this is due tonight!!
when I click menu option 6 it does not print out what I need it too. To edit the player stats. (see photos from link)
When the code is ran in the shell it needs look like the directions I was given. (see 1st link for photo)
Please see the photos of everything I have linked below thank you!!!
the 1st link is the one that has the code ran in the right and what the code needs to look like on the left (directions)

Image links removed.

thanks!!!!


RE: HELP DUE TONIGHT - Mekire - Nov-22-2017

No photos of code.  We need you to paste your code in here in code tags.  Also be aware we will not provide help if we do not see effort.  You need to show us what you have tried so far and explain how/why it isn't working.


RE: HELP DUE TONIGHT - AMRiley23 - Nov-22-2017

Here is my code right now all written but when I run it in shell and click menu option 6 I need it to print out what is shown on my assignment directions.



Here is my code right now all written but when I run it in shell and click menu option 6 I need it to print out what is shown on my assignment directions.
https://trinket.io/python/daa7dfb0bc



this is the directions what I need it to look like when I choose menu option 6
http://s1259.photobucket.com/user/AMRiley23/media/Assignment%204_zps0yug968o.png.html?o=0

players = [["Joe", "P", 10, 2], ["Tom", "SS", 11, 4], ["Ben", "3B", 0,0]]
positions = ("1B", "2B", "3B", "C", "LF", "SS", "CF", "RF", "P")

def list_All_Players():
print("#\t" + "Name\t" + "Pos\t" + "Bat\t" + "Hit")
print("------------------------------------------------------------------")
for player in players:
print(str(players.index(player)) + "\t" + player[0]\
+ "\t" + player[1] + "\t" + str(player[2]) +\
"\t" + str(player[3]))
def show_Menue():
print("\t\t Baseball Team Manager")
print("-------------------------------------------------------------------")
print("Menu Options")
print("1-Display the lineup")
print("2-Add Player")
print("3-Remove Player")
print("4-Move Player")
print("5-Edit Player Position")
print("6-Edit Player Stats")
print("7-Exit Program")
print("Positions")
print("C, 1B, 2B, 3B, SS, LF, RF, P")
print("-------------------------------------------------------------------")
print("-------------------------------------------------------------------")

def edit_Player_Position():
playerno = int(input("Enter a player # \t"))
newposition = input("Enter a new position \t")
while newposition not in positions:
newposition = input("Enter a valid position \t")
players[playerno][1] = newposition
def move_A_Player():
playerno = int(input("Enter a player # \t"))
newnum = int(input("Enter a number to move player to \t"))
moved = players.pop(playerno)
players.insert(newnum, moved)

def remove_A_Player():
playerno = int(input("Enter a player # you want to remove \t"))
players.remove(players[playerno])

def add_New_Player():
name = str(input("Name: "))
position = str(input("Postion: "))
atbats = int(input("At Bats: "))
hits = int(input("Hits: "))
player = []
player.append(name)
player.append(position)
player.append(atbats)
player.append(hits)
players.append(player)

def edit_Player_Stats():
playerno = int(input("Enter a player # \t"))
if choice == 1:
atbat = int(input("Enter new at bat value \t"))
players[playerno][2] = atbat
elif choice ==2:
hits = int(input("Enter a new hit value \t"))
players[playerno][3] = hits
show_Menue()
option = int(input("Please enter your option \t"))
while option != 7:
if (option == 1):
list_All_Players()
elif (option ==2):
add_New_Player()
elif (option == 3):
remove_A_Player()
elif (option == 4):
move_A_Player()
elif (option == 5):
edit_Player_Position()
elif (option ==6):
edit_Player_Stats()
if (option ==7):
print("Bye")
option = int(input("Please enter your option\t"))


RE: HELP DUE TONIGHT - Larz60+ - Nov-22-2017

see BBCODE


RE: click menu option 6 it does not print out what I need it to - nilamo - Nov-27-2017

Look at the code you shared.  Is it obvious to you how it works? 
Without indentation, that's complete nonsense.  If you don't understand it, how are we?