How do I print only 1 copy of data? I am a complete beginner. This is Python code I did for Add data.
This is my current output:
Row | Name | Age | Grade
1 jo 23 1
2 jo 23 1
1 ki 24 2
2 ki 24 2
This is my expected output:
Row | Name | Age | Grade
1 jo 23 1
2 ki 24 2
Here is my code:
name = []
age = []
grade = []
record = []
rowCount = 0
choice = 1
while int(choice) != 0:
if int(choice) > 4 or int(choice) < 1:
choice = input ("Invalid input. Enter choice: ")
else:
print("Main Menu:")
print("1- Add")
print("2- Delete")
print("3- Edit")
print("4- Print Report")
print("0- End Program")
choice = input ("Enter choice: ")
if int(choice) == 1: #Add function
name.append(input("Input Name: "))
age.append(input("Input Age: "))
grade.append(input("Input Grade: "))
print ("Row | Name | Age | Grade")
for x, y, z in zip(name,age,grade):
for w in range(len(name)):
print(str(w+1) + " " + x + " " + y + " " + z)
w+1
elif int(choice) == 2: #Delete function
print("Delete func")
elif int(choice) == 3: #Update function
print("Edit func")
elif int(choice) == 4: #Print function
print("Print func")
print("Ending Program...")