Hi I have question in Python, If my question is duplicate. Please link to the solution that have the similarity between mine
I have this function which set idinput from input() however, the value don't change and from another function it read it as 0, and AddStudents() Function doesn't change it value. It append to the list correctly but in another function it read it as initial 0
materials = {}
student = {}
sidlist = []
idinput = 0
# Add Students
def AddStudent():
idinput = int(input("ID: "))
name = input("Name: ")
lastname = input("LName:")
student.update({idinput: {name: lastname}})
# Append ID To ID List
sidlist.append(int(idinput))
AddMaterial()
def AddMaterial():
materialinp = input("MAT:")
degreeinp = int(input("DEGREE:"))
sidlist.append(idinput)
materials.update({idinput: {materialinp: degreeinp}})
askUserToContinue = input("Do you like to add more materials?: y/n")
if askUserToContinue.lower() == "y":
AddMaterial()
else:
print("Do you like to add more student or do search y/n")
askUserChoice = input(": ")
if askUserChoice.lower() == "y":
AddStudent()
else:
GetInfo()
and Thank you.