Python Forum
click menu option 6 it does not print out what I need it to
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
click menu option 6 it does not print out what I need it to
#1
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!!!!
Reply
#2
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.
Reply
#3
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/AMRile...g.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"))
Reply
#4
see BBCODE
Reply
#5
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?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  form select option tags, add "selected" on <option> in python at a condition Leon79 3 2,635 Jul-14-2020, 05:00 PM
Last Post: Leon79

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020