-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfinal_review.rb
70 lines (43 loc) · 1.03 KB
/
final_review.rb
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
names = []
while true
puts "type name and type done when finished"
name = gets.chomp
break if name == "done"
names << name
end
names.shuffle!
while names.any?
if names.length == 3
group = names.pop(3)
else
group = names.pop(2)
end
puts "Group: #{group.join(", ")}"
end
# people_in_class = []
# puts "Please type each students name and when done type done"
# while true
# person = gets.chomp
# if person == "done"
# break
# end
# people_in_class << person
# end
# randomize = people_in_class.shuffle
# num = 0
# if randomize.length % 2 == 0
# while num < people_in_class.length
# puts "Group #{randomize[num]} #{randomize[(num + 1)]}"
# num += 2
# end
# else
# while num < people_in_class.length
# if (people_in_class.length - num) == 3
# puts "Group #{randomize[num]} #{randomize[(num + 1)]} #{randomize[(num + 2)]}"
# break
# else
# puts "Group #{randomize[num]} #{randomize[(num + 1)]}"
# num += 2
# end
# end
# end