User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 427,770 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,767 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser: Programming Forums
Views: 829 | Replies: 0
Reply
Join Date: Nov 2006
Posts: 1
Reputation: hafe4k is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
hafe4k hafe4k is offline Offline
Newbie Poster

Help

  #1  
Nov 28th, 2006
Need some help in python.
How do i make the user choose wheter or not to pick it up? (i can do picking up an item from a list):
objectsCarried = []
inventory = ['bat']
lengthOfInventory =len(inventory)
print 'The room holds:'
for item in range(lengthOfInventory):
print item, inventory[item]

numberChosen = int(raw_input('use the number to pick up an item '))
objectChosen = inventory[numberChosen]
objectsCarried.append(objectChosen)
inventory.remove(objectChosen)
print 'you are carrying '
for item in objectsCarried:
print item
print
print 'The room now holds:'
for item in inventory:
print item

But i cant do when u have a choice to pick up or not.
Also if not too much trouble then how can i do:

IF the user picks the bat up then when he comes across the vampire then he kills it, but if he hasnt pickd up the bat then he dies?

Thanks in advance
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Python Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the Python Forum

All times are GMT -4. The time now is 1:19 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC