-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheven-odd.py
More file actions
34 lines (28 loc) · 793 Bytes
/
Copy patheven-odd.py
File metadata and controls
34 lines (28 loc) · 793 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
28
29
30
31
32
33
34
import random
def even_detector_unique():
x = int( input('Enter X value:') )
ran_array = []
ran_array = random.sample(range(1, 10), x)
for i in ran_array:
print (i)
print ('\n')
for i in ran_array:
if i%2 == 0:
print('{0} is even'.format(i))
else:
print('{0} is odd'.format(i))
even_detector_unique()
# First function i created before knowing how to get unique random int
def even_detector():
x = int( input('enter X value:') )
ran_array = []
for i in range(0,x):
r = random.randint(1, 10)
print(r)
ran_array.append(r)
for i in ran_array:
if i%2 == 0:
print('{0} is even'.format(i))
else:
print('{0} is odd'.format(i))
#even_detector()