Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
random library
#1
This is my code:

[python=import random

print('''
Benvenuto al programma: 'Carta Forbice Sasso'

Creato da: Federico Oblatore
''')

scelta = input('Cosa scegli? ')

insieme = ['carta', 'forbice', 'sasso']

str(scelta)

if scelta == 'carta' or scelta == 'Carta':
print(random.choice(insieme))
if (random.choice(insieme)) == 'forbice':
print('Hai perso :(')
elif (random.choice(insieme)) == 'carta':
print('Pareggio')
elif (random.choice(insieme)) == 'sasso':
print('Hai vinto!!')][/python]


but in the idle it write the random element but the 'elifs' dont work
Reply


Messages In This Thread
random library - by FedeZsuper - Oct-26-2020, 06:14 PM
RE: random library - by Larz60+ - Oct-26-2020, 06:38 PM
RE: random library - by bowlofred - Oct-26-2020, 06:57 PM
RE: random library - by stullis - Oct-26-2020, 06:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  PyInstaller, how to create library folder instead of library.zip file ? harun2525 2 4,790 May-06-2017, 11:29 AM
Last Post: harun2525

Forum Jump:

User Panel Messages

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