-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmagic_python.py
More file actions
27 lines (22 loc) · 772 Bytes
/
magic_python.py
File metadata and controls
27 lines (22 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## Magic School Bus Game
import numpy as np
import random
## Rider
human_name = input('Who''s riding the bus today? (enter name): ')
print('Welcome to the Magic School Bus Game:\n',human_name)
## Pick a number
number_input = input('Type Any Number:')
print(human_name,'selected',
number_input,'\n')
# Build array from 1 to selected number
x = np.arange(1,int(number_input)+1,1)
# Randomly select a number from x
rand1 = random.choice(x)
## Guess the type of the random number
evenodd = input('Guess Whether the Next Randomly Selected Number is Even or Odd (type even or odd): ')
# Determine if even
even_vars = np.arange(2,int(number_input)+1,2)
print('\n',even_vars,'\n')
# Determine if odd
odd_vars = np.arange(1,int(number_input)+1,2)
print('\n',odd_vars,'\n')