Skip to content

Instantly share code, notes, and snippets.

@ekiara
Last active March 26, 2023 14:50
Show Gist options
  • Save ekiara/bc704fc3ed823612bd658b52e3bbcb83 to your computer and use it in GitHub Desktop.
Save ekiara/bc704fc3ed823612bd658b52e3bbcb83 to your computer and use it in GitHub Desktop.
random-script-for-tonrandall-list-of-tuples
"""
Random Script for TonRandall online.
DESCRIPTON:
Generate a list of tuples where the first item in the tuple
is an integer and the second item in the tuple is the first
number squared. The script should not require any user input.
USAGE
python ./random-script-for-tonrandall-list-of-tuples.py
Returns:
[(5, 25), (21, 441), (33, 1089), (12, 144), (9, 81), (28, 784), (14, 196), (29, 841)]
- Hope this helps! 👍🏽
"""
import random
LEN = 8
def generate_tl():
tl = []
for i in range(LEN):
number = random.randint(1,33)
tl.append((number, number**2))
return tl
if __name__ == "__main__":
result = generate_tl()
print(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment