我不能在if语句python之后输入

时间:2017-09-14 17:16:26

标签: python python-2.7 python-3.x

我有一段代码,在我的输入之后我只要输入的地方就是它所说的但是要求输入,即使我没有输入食物,例如它问你在哪里吃无论如何要解决这个问题,所以我可以在if语句之后请求输入

print("Welcome to how much i spend made my Arran")

price1 = float(input("how much was your first purchase this mounth"))
where1 = input("Where did you spend this shops, food, entertainment, mortage, bills, supermarket")

if where1 == "shops" or "Shops" or "shop" or "Shop":
    shop1 = input("What was the name of the shop")

if where1 == "Food" or "food":
    food1 = input("What was the name of the restraunt or fast food u ate at")


if where1 == "entertainment" or "Entertainment":
    entertainment1 = input("What type of enternainment was it")

if where1 == "Supermarket" or "supermarket":
    supermarket1 = input("What supermarket was it")
    *emphasized text*

1 个答案:

答案 0 :(得分:0)

您的条件陈述不正确

你需要使用这样的东西:

export class MyInterceptor implements HttpInterceptor {

    intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
        const headers = new HttpHeaders();
        this.addHeader(headers); // This will add headers

        const changedReq = req.clone({ headers: headers });
        return next.handle(req)
            .catch(err => {
                if (err instanceof HttpErrorResponse) {
                    switch (err.status) {
                        case 302:
                        case 401:
                            window.location.href = "http//google.com";
                            break;             
                        default:
                            throw new Error(this.getErrorMessage(err));
                    }
                }

                return Observable.throw(err);
            });
    }