为什么我的条件语句不能在python中工作

时间:2016-12-15 11:23:58

标签: python conditional

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline

x=np.arange(0,20)
y=2*x

fig,ax=plt.subplots()
ax.scatter(x,x)

ax.scatter(x,y)
fig

我输入的代码无法正常工作我从昨天起就被困在这里我正在努力学习python但是我被困在这里请帮帮我

2 个答案:

答案 0 :(得分:1)

试试这个:

instructions  =  ['-Press  [W]  To  Walk  Forward  (-Hold  [Left  Shift]  To Initiate Runing)','-Press [S] To Move Backwards' '-[A] For Left','-[D] For Right','-[space] For Jump']

password = input("Enter password")

if password == "food":
      print("here")
      for i in instructions:
          print (i)

else:
    print("not correct")

答案 1 :(得分:0)

取代

password  =  sys.stdin.readline()

请严格按照以下方式使用。

(Python 2)

password = raw_input()

(Python 3)

password = input()