.
This commit is contained in:
11
CS1032/practical-2023-11-15/pass.py
Normal file
11
CS1032/practical-2023-11-15/pass.py
Normal file
@@ -0,0 +1,11 @@
|
||||
#! /usr/bin/env python3
|
||||
import sys, random
|
||||
|
||||
with open(sys.argv[1]) as words_f:
|
||||
words = [word for line in words_f if 3 <= len(word := line.strip()) < 10 and word.lower() == word]
|
||||
|
||||
pair = []
|
||||
while not 8 <= sum(map(len, pair)) <= 10:
|
||||
pair = random.choices(words, k=2)
|
||||
|
||||
print(''.join(w.title() for w in pair))
|
||||
Reference in New Issue
Block a user