Advertisement
Guest User

Untitled

a guest
Jun 18th, 2022
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. import random
  2.  
  3. #sets up list to pull strings from
  4. heroes = ['Barbarian King', 'Archer Queen', 'Shield Maiden', 'Countess', 'Monk', 'Royal Champion', 'Skeleton King']
  5. decklist = []
  6.  
  7. #repeats twice: gives a random option from those listed, and prints it
  8. #first string is removed from the list to not be chosen twice, and added back after second string is chosen
  9. print('Choose your hero:')
  10. hero_choice_one = random.choice(heroes)
  11. print(f'Option 1: {hero_choice_one}')
  12. heroes.remove(hero_choice_one)
  13. hero_choice_two = random.choice(heroes)
  14. print(f'Option 2: {hero_choice_two}')
  15. heroes.append(hero_choice_one)
  16.  
  17. #asks for an input of either of the two strings, and if entered string is not equal to the random strings chosen,
  18. #asks for input again. then adds choice to decklist(decklist is used for a larger chunk of code)
  19. deck_choice = input('Type the exact name of the hero you wish to choose.')
  20. while deck_choice != hero_choice_one or hero_choice_two:
  21. print('Please choose a hero from the two options(Type their names exactly as you see them)')
  22. deck_choice = input('Hero: ')
  23. decklist.append(deck_choice)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement