切片字典以打印特定信息

时间:2017-02-21 00:37:36

标签: python-3.x

这是我正在努力的一些事情的一部分,但我需要弄清楚如何为这一部分做这件事才能继续前进。

注意:这不是家庭作业,只是个人项目。

Roxanne = {'Location': 'Rustboro City', 'Type': 'Rock',
       'Pokemon Used': 'Geodude: Lvl 12, Geodude: Lvl 12, Nosepass: Lvl 15'}

user = input("What would you like to learn about: Gym Leaders, Current Team, Natures, or Evolution ")

if user == 'Gym Leaders' or 'gym leaders':

   response = input('Who would you like to learn about? '
                 'Roxanne, Brawly, Wattson, Flannery, Norman, Winona, The Twins, or Juan? ')

      if response == 'Roxanne' or 'roxanne':

        ask = input('What would you like to know about? Location, Type, Pokemon Used ')

          if ask == 'Location' or 'location':

           # i need to print the location part of the Roxanne dictionary here, i.e. 'Rustboro City'

我只是测试我是否应该根据用户输入打印整个'Roxanne'字典,或者是否应该打印单个信息,以便用户可以找到特定信息。

最后,我唯一的蟒蛇体验是我现在正在Uni的入门课程,所以没有太多困难或复杂。我自己设定的挑战是保持在课程范围内。

0 个答案:

没有答案