Skip to content

Commit 6455770

Browse files
Add files via upload
1 parent 0eef119 commit 6455770

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

jarviscli/plugins/spinthewheel.py

+19-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
11
from plugin import plugin
22
import random
3-
'''This code picks one of the random inputs given by the user
4-
like spin wheel'''
53

64

7-
@plugin("spin wheel")
5+
def spinit(list):
6+
return(random.choice(list))
7+
8+
9+
@plugin("spinwheel")
810
def spin(jarvis, s):
11+
"""
12+
\nThis code picks one of the random inputs given by the user
13+
smilar to spin wheel
14+
15+
"""
916
jarvis.say(' ')
1017
jarvis.say('welcome to spin the wheel\n')
1118
jarvis.say('enter the number of elements in the wheel')
12-
num = jarvis.input()
13-
num = int(num)
19+
num = jarvis.input_number()
1420
jarvis.say('enter the elements one after another\n')
1521
wheel = []
16-
for i in range(0, num):
22+
for i in range(0, int(num)):
1723
entry = jarvis.input()
1824
wheel.append(entry)
19-
jarvis.say('Let the wheel spin !!!!!!!!!\n')
20-
jarvis.say('result is: ' + random.choice(wheel))
25+
reply = 'y'
26+
while (reply == 'y'):
27+
jarvis.say('Let the wheel spin !!!!!!!!!\n')
28+
jarvis.say('result is: ' + spinit(wheel))
29+
jarvis.say('Do you want to spin again?? press:y ')
30+
reply = jarvis.input()
31+
jarvis.say("Thank you for trying spin wheel ")

0 commit comments

Comments
 (0)