Python Forum

Full Version: urgent , Python homework
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is what I am supposed to do :



(Anagrams) An anagram of a string is another string formed by rearranging the letters in the first.
Write a script that produces all possible anagrams of a given string using only techniques that
you’ve seen to this point. (Translation Dictionary)
Use an online translation tool such as Bing Microsoft Translator or Google Translate to translate
English words to another language. Create a translations dictionary that maps the English words
to their translations.
5
Display a twocolumn table of translations.
(Synonyms Dictionary)
Use an online thesaurus to look up synonyms for five words, then create a synonyms dictionary
that maps those words to lists containing three synonyms for each word.
Display the dictionary’s contents as a key with an indented list of synonyms below it.

This is what I have done so far :
#Anagrams
import random
import dictionnary 
a = input("Please enter apers ")
x = ["a","p","e","r","s"]
try:
    while(a=="apers" or a=="Apers"):
        print(random.choice(x)+random.choice(x)+random.choice(x)+random.choice(x)+random.choice(x))
        a = input("Please enter apers ")
        
        
     
except:
    a = input("Please enter apers ")
Thank u in advance Big Grin Heart
(May-08-2021, 03:53 PM)alm Wrote: [ -> ]This is what I am supposed to do :



(Anagrams) An anagram of a string is another string formed by rearranging the letters in the first.
Write a script that produces all possible anagrams of a given string using only techniques that
you’ve seen to this point. (Translation Dictionary)
Use an online translation tool such as Bing Microsoft Translator or Google Translate to translate
English words to another language. Create a translations dictionary that maps the English words
to their translations.
5
Display a twocolumn table of translations.
(Synonyms Dictionary)
Use an online thesaurus to look up synonyms for five words, then create a synonyms dictionary
that maps those words to lists containing three synonyms for each word.
Display the dictionary’s contents as a key with an indented list of synonyms below it.


This is what I have done so far :
#Anagrams
import random
import dictionnary 
a = input("Please enter apers ")
x = ["a","p","e","r","s"]
try:
    while(a=="apers" or a=="Apers"):
        print(random.choice(x)+random.choice(x)+random.choice(x)+random.choice(x)+random.choice(x))
        a = input("Please enter apers ")
        
        
     
except:
    a = input("Please enter apers ")
Thank u in advance Big Grin Heart
code result for now :
Error:
= RESTART: C:/Users/naza/AppData/Local/Programs/Python/Python39/Homework lab.py Traceback (most recent call last): File "C:/Users/naza/AppData/Local/Programs/Python/Python39/Homework lab.py", line 3, in <module> import dictionnary ModuleNotFoundError: No module named 'dictionnary'

ok
The error you have ModuleNotFoundError: No module named 'dictionnary' is because you are trying to import dictionnary but there is no dictionnary module to import, have you not created it yet or do you maybe have a typo in its name?