How To Determine Grades in Python [closed]

Besides the error with the ( going through the code some modifications could make this a little more optimal. We can use a try, except block to eliminate the ERROR else statement and handle that directly when we receive the input if is not a valid int and we force a valid int between 0 … Read more

Convert tuple and string to list

For this particular situation, you can use eval. >>> n = (102, ‘(24, -20)’) >>> n = list(n) >>> n [102, ‘(24, -20)’] >>> n[1] = eval(n[1]) >>> n [102, (24, -20)] >>> new = (n[0], [1][0], n[1][1]) >>> new (102, 1, -20)

Oops, try again. Your function failed on the message yes. It returned 'yes' when it should have returned 'Shutting down'

Couple of points: Misplaced return statement. Should be at end. if yes(): It is wrong. You want to compare function input with yes. It should be if s == ‘yes’:. Same for rest also. Since you have written function definition as def shut_down(s):, it is expecting one argument. You should pass one argument while calling … Read more