Hack #1

Made more efficient Collatz conjecture code

i = int(input("Input a number to be sent through the Collatz conjecture"))
print("Input: " + str(i))
list = []
while i != 1:
   if (i % 2):
      i = int(3*i + 1)
   else:
      i = int(i/2)
   list.append(i)
print(list)
print("It took " + str(len(list)) + " tries to equal 1")
Input: 100000
[50000, 25000, 12500, 6250, 3125, 9376, 4688, 2344, 1172, 586, 293, 880, 440, 220, 110, 55, 166, 83, 250, 125, 376, 188, 94, 47, 142, 71, 214, 107, 322, 161, 484, 242, 121, 364, 182, 91, 274, 137, 412, 206, 103, 310, 155, 466, 233, 700, 350, 175, 526, 263, 790, 395, 1186, 593, 1780, 890, 445, 1336, 668, 334, 167, 502, 251, 754, 377, 1132, 566, 283, 850, 425, 1276, 638, 319, 958, 479, 1438, 719, 2158, 1079, 3238, 1619, 4858, 2429, 7288, 3644, 1822, 911, 2734, 1367, 4102, 2051, 6154, 3077, 9232, 4616, 2308, 1154, 577, 1732, 866, 433, 1300, 650, 325, 976, 488, 244, 122, 61, 184, 92, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1]
It took 128 tries to equal 1

Hack #2

import random
i = int(input("How many numbers do you want"))
for a in range(i):
   run = random.randint(1,10)
   print(run)
   if (run%2!=0):
      print("The random number is odd")
   else:
      print("The number is even")
8
The number is even
7
The random number is odd
10
The number is even
3
The random number is odd
7
The random number is odd
import random

a = random.randint(1,10)

b = random.randint(1,10)

c = random.randint(1,10)

d = random.randint(1,10)

e = random.randint(1,10)

print(a)
if (a%2!=0):
   print("The random number is odd")
else:
   print("The random number is even")
print(b)
if (b%2!=0):
   print("The random number is odd")
else:
   print("The number is even")
print(c)
if (c%2!=0):
   print("The random number is odd")
else:
   print("The number is even")
print(d)
if (d%2!=0):
   print("The random number is odd")
else:
   print("The number is even")
print(e)
if (e%2!=0):
   print("The random number is odd")
else:
   print("The number is even")
2
The random number is even
9
The random number is odd
10
The number is even
10
The number is even
2
The number is even

Hack #3

As you can see, the second cell has way more lines then the first cell and is less efficient then the first cell. This is due to the while loop and the use of variables in the first cell. The while loop let me loop through the same if statement multiple times so I don't have to define and write 5 different variables and if statements like I had to in the second cell.

Hack #4

Throughout the first hack and the 3rd hack I used variables, if statements, and loops to program your algorithm to make my hack more efficient.