subject

So for some reason my random number generator just breaks my code and i want to know how to make my random generator to pick 5 numbers out of 10. here's my code:

# fallout console edition

import random

def main():

# base dialouge for beginning of game.

print("hello, welcome to the fallout event, a python made rpg.")

# simple character info

character_gender = input("enter your character's gender: ")

character_name = input("enter your character's name: ")

character_health = 100

# intro

keep_going = input("enter '25 cents'to play and after dieing enter '25 cents'. ")

print("your beloved vault 23, your own friends and family have cast you out due to your behavior as a, per say, loose cannon. before being cast to the wasteland, you were given an old pipboy-3000 and with it you have entrusted your life. with the pipboy you will store items to your inventory and so on.")

while keep_going == '25 cents' :

print("after leaving glorious vault 23, you find a crate and find five items ")

# failed attempt at trying to give you 5 random items from the crate but it just breaks.

for x in range(5):

random_number = random. randint(1,10)

if random_number == 1:

print("you have found a 10mm pistol(+ 20 ap)! ")

if random_number == 2:

print("you have found a switchblade(+ 10 ap)! ")

if random_number == 3:

print("you have found a stimpak(+ 50 hp)! ")

if random_number == 4:

print("you have found a tube of wonderglue! ")

if random_number == 5:

print("you have found a coffee mug! ")

if random_number == 6:

print("you have found a old baseball! ")

if random_number == 7:

print("you have found an antique globe! ")

if random_number == 8:

print("you have found a gold platted flip lighter! ")

if random_number == 9:

print("you have found a box of blamco mac and cheese(+ 25 hp)! ")

if random_number == 10:

print("you have found a raider chest piece(+1 to defense)! ")

main()

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 17:30, Samsonb
Working on this program in python 3.7: a year in the modern gregorian calendar consists of 365 days. in reality, the earth takes longer to rotate around the sun. to account for the difference in time, every 4 years, a leap year takes place. a leap year is when a year has 366 days: an extra day, february 29th. the requirements for a given year to be a leap year are: 1) the year must be divisible by 42) if the year is a century year (1700, 1800, the year must be evenly divisible by 400some example leap years are 1600, 1712, and 2016.write a program that takes in a year and determines whether that year is a leap year. ex: if the input is 1712, the output is: 1712 is a leap year. ex: if the input is 1913, the output is: 1913 is not a leap year. your program must define and call the function isleapyear(useryear). the function should return true if the input year is a leap year and false otherwise.
Answers: 1
image
Computers and Technology, 23.06.2019 00:30, devenybates
Which one of the following is the most accurate definition of technology? a electronic tools that improve functionality b electronic tools that provide entertainment or practical value c any type of tool that serves a practical function d any type of tool that enhances communication
Answers: 1
image
Computers and Technology, 23.06.2019 12:00, deflox74
What does the level 1 topic in a word outline become in powerpoint? a. first-level bullet item b. slide title c. third-level bullet item d. second-level bullet item
Answers: 1
image
Computers and Technology, 23.06.2019 15:30, Dweath50
The processing of data in a computer involves the interplay between its various hardware components.
Answers: 1
You know the right answer?
So for some reason my random number generator just breaks my code and i want to know how to make my...

Questions in other subjects:

Konu
Mathematics, 21.10.2020 02:01
Konu
Chemistry, 21.10.2020 02:01