How to remove [''] when i try to print a list

Viewed 51

so far this is my code:

import random


choices = ["Rock","Paper","Scissors"]

computer = random.choices(choices)

player = input("Rock, paper or scissors??: ").lower()

print("Player :",player)
print("Computer: ",computer)"

when i try to print it says

Rock, paper or scissors??: gun
Player : gun
Computer:  ['Paper']

how can I remove [''] from my output and only print "paper"

any help would be appreciated.

2 Answers

Your print an array, thus call the first element. What was suggested in the comments above random.choice() is to select element in str format rather then array format

print("Computer: ",computer[0])

But if you want the parenthesis

print("Computer: [{}]".format(computer[0]))
Related