Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
random in python
#1
Question 
I seem to have a problem. When I use
random.choice it will print out the list instead. here is the code and the output
first the code
print('Welcome to the fart monster game')
print('----------------------------------')
user=input('What is your name ')
print("ok",user,"here are the controls: g(grab),l(left),r(right),u(up),d(down)")
import random
rooms= ['bedroom','dungeon','The Motionless Maze','kitchen','bathroom','office']
random.choice(rooms)
start=input('press n to start')
if start =='n':
 print('You are thrown into the',rooms,)

elif start != ('n'):
    print('that is invalid')
lifes=10
and output
Output:
Welcome to the fart monster game ---------------------------------- What is your name d ok d here are the controls: g(grab),l(left),r(right),u(up),d(down) press n to startn You are thrown into the ['bedroom', 'dungeon', 'The Motionless Maze', 'kitchen', 'bathroom', 'office']
And also if you see any problems with the code please let me know
Reply


Messages In This Thread
random in python - by ilikedofs - Jun-02-2021, 12:09 AM
RE: random in python - by deanhystad - Jun-02-2021, 12:35 AM
RE: random in python - by BashBedlam - Jun-02-2021, 01:14 AM
RE: random in python - by menator01 - Jun-03-2021, 05:44 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020