我们的任务是检查一个线性规划问题成功终止了多少次,然而每次失败都让我置身于循环之外,有没有一种方法可以让我在进行测试的同时继续下一次迭代? from scipy.optimize import linprogf = [1 , 1 ]
hit = 0
norm1 = np.random.normal(-0.1,0.03) #a random value taken from the norm
但我不知道是否应该使用except或except ValueError来验证每个答案。#This would be repeated for the two other questionswhile True: except ValueError:
print("That's not a valid answer. Please enter an integer.")
我很难修复一个valueError,'OrderItem' instance needs to have a primary key value before a many-to-many relationshipraise ValueError("%r instance needs to have a primary key value before a many-to-many relationship can__name__)
Exception Type: ValueError at /me