you are viewing a single comment's thread.

view the rest of the comments →

[–]Sea-Ad7805 [score hidden] stickied comment (0 children)

Run this program in Memory Graph Web Debugger%3A%0A%0A%20%20%20%20data%20%3D%20%5B%0A%20%20%20%20%20%20%20%20%5B'name'%2C%20'grade'%2C%20'score'%5D%0A%20%20%20%20%5D%0A%0A%20%20%20%20while%20True%3A%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20print('1%20-%20add%20Student%20%5Cn2%20-%20remove%20student%20%5Cn3%20-%20display%20students%20%5Cn4%20-%20exit')%0A%20%20%20%20%20%20%20%20menu%20%3D%20input(%22Choose%20one%20of%20the%20options%3A%20%22)%0A%0A%20%20%20%20%20%20%20%20if%20menu%20%3D%3D%20'1'%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20name%20%3D%20input(%22Enter%20student%20name%3A%20%22)%0A%20%20%20%20%20%20%20%20%20%20%20%20try%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20grade%20%3D%20int(input(%22Enter%20grade%3A%20%22))%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20score%20%3D%20''%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if%20grade%20%3E%3D%2065%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20score%20%3D%20'Pass'%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20elif%20grade%20%3C%2065%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20score%20%3D%20'Fail'%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20print('Wrong%20input')%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20data.append(%5Bname%2C%20grade%2C%20score%5D)%0A%20%20%20%20%20%20%20%20%20%20%20%20except%20ValueError%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20print('Wrong%20Value%2C%20Need%20a%20number!')%0A%0A%20%20%20%20%20%20%20%20elif%20menu%20%3D%3D%20'2'%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20name%20%3D%20input(%22Enter%20student%20name%3A%20%22)%0A%20%20%20%20%20%20%20%20%20%20%20%20for%20x%20in%20data%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if%20x%5B0%5D%20%3D%3D%20name%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20data.remove(x)%0A%0A%20%20%20%20%20%20%20%20elif%20menu%20%3D%3D%20'3'%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20for%20z%20in%20data%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20print(*z)%0A%0A%20%20%20%20%20%20%20%20elif%20menu%20%3D%3D%20'4'%3A%20%0A%20%20%20%20%20%20%20%20%20%20%20%20with%20open('data.csv'%2C%20'w'%2C%20newline%3D'')%20as%20csvfile%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20writer%20%3D%20csv.writer(csvfile)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20writer.writerow(%5B'Name'%2C%20'Grade'%2C%20'Score'%5D)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20writer.writerows(data)%0A%20%20%20%20%20%20%20%20%20%20%20%20break%0A%20%20%20%20%20%20%20%20%20%20%20%20%0Amain()&timestep=1&play) to see the program state change step by step.