scramble_ee.py

Created by laigna

Created on March 14, 2026

1.03 KB

Arva ära segipaisatud juhuslik sõna. Segatakse uuesti, kui tulemus kattub algse sõnaga.


# Sonapusle - NumWorks
# Created by Alvar Laigna - https://alvarlaigna.com
from random import choice,randint

W = [
  "KOOL","MAJA","AUTO","KOER","KASS",
  "LINN","METS","VESI","TULI","PILV",
  "TUUL","LUMI","KALA","LIND","PALL",
  "TOOL","LAUD","AKEN","PILT","KIVI",
  "PUIT","ROHI","LEHT","SILD","KOOK",
  "PIIM","LEIB","KEEL","SAAR","RAND",
  "SEIN","JALG","SILM","NINA","KARU",
  "HUNT","HIIR","KUKK","KANA","SEEN",
  "MARI","LILL","TAMM","KASK","LAEV",
  "RONG","VALGE","MUST","TALV","SUVI",
  "KEVAD","MERI","LOSS","TORN","KATUS",
  "RATAS","REBANE","KUUSK","SUITS"]

def shuf(a):
 for i in range(len(a)-1,0,-1):
  j=randint(0,i)
  a[i],a[j]=a[j],a[i]

def mang():
  print("\n"*20+"SONAPUSLE\n")
  word = choice(W)
  s = list(word)
  shuf(s)
  if "".join(s)==word:
    shuf(s)
  print("Segatud:","".join(s))
  print("("+str(len(word))+" tahte)")
  g = input("Sinu vastus: ").upper().strip()
  if g==word:
    print("Oige! Tubli!")
  else:
    print("Vale! Oli:",word)
  if input("Uuesti? j/e: ").lower()=="j":
    mang()

mang()

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.