codeShare commited on
Commit
f40021b
·
verified ·
1 Parent(s): 30ff13b

Upload tag_randomizer.ipynb

Browse files
Files changed (1) hide show
  1. tag_randomizer.ipynb +1 -0
tag_randomizer.ipynb ADDED
@@ -0,0 +1 @@
 
 
1
+ {"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"provenance":[],"authorship_tag":"ABX9TyMyzXqAdVCO9/Oi5ACZm79R"},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"}},"cells":[{"cell_type":"code","source":[],"metadata":{"id":"hdvh6wzaEFVB"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["# Import required library\n","import random\n","\n","# Input text\n","input_text = 'A,B,C|D,E,F|G,H,I' #@param {type:'string'}\n","\n","# Split the text into groups\n","groups = input_text.split('|')\n","\n","# Randomize letters within each group\n","randomized_groups = []\n","for group in groups:\n"," letters = group.split(',')\n"," random.shuffle(letters)\n"," randomized_groups.append(','.join(letters))\n","\n","# Join the groups back together\n","output_text = '|'.join(randomized_groups)\n","\n","# Write to a text file\n","with open('randomized_output.txt', 'w') as file:\n"," file.write(output_text)\n","\n","# Print the result to verify\n","print(\"Randomized output:\", output_text)\n","\n","# Download the file in Colab\n","from google.colab import files\n","files.download('randomized_output.txt')"],"metadata":{"id":"XifDdzLoC-P2"},"execution_count":null,"outputs":[]}]}