CSCI 2202 Dalhousie Create Python Code Using Anaconda Navigator Computer Coding Task

User Generated

731242741_

Programming

CSCI 2202

Dalhousie University

CSCI

Description

please use anaconda navigator to write a python field

Unformatted Attachment Preview

Programming in Python for Scientists CSCI 2202 Project 1b Due: 15 April 2021 Project: Finding Anagrams Recursively The Problem: An anagram is the word obtained by permuting (rearranging) the letters of a given word. e.g. ‘trace’ can give ‘crate’, ’react’, ‘cater’. For a word of length n, there are n! (n factorial ) candidate permutations. Only a few of these are valid words. The validity of the words can be checked against a list of words, which will be provided. This list of words is read-in as the lexicon to check if the candidate anagram against. The word list must be read-in and stored as list. Initialize the list right after you import statements, outside any function. The Idea: • To start tackling the problem pick the 1st letter. • Do this systematically: you will need to do this for every letter, but start at the 1st . • For each choice of 1st letter, try all possible orderings of the remaining letters. • You will use recursion to handle this rearrangement. For Example: • If using trace and the 1st letter chosen is c (from trace). • The rest of the letters are the letters to use are: trae. • When rearranging these letters, aret, ater rate are meaningful as they result in: caret, cater, crate, which are in the word-list. Method: To solve the problem, create a function anagrams. This function accepts three parameters: (1) The list of valid words (i.e. the word-list). (2) The letters to use (trae above). (3) The prefix (c above). For example, an initial call to anagrams is: anagrams(word-list, ’trace’, ’ ’). There are five choices for the 1st letter, each of those choices generates a recursive call, like: anagrams(word-list, ’race’, ’t’). Each of the recursive calls generates and returns a solution list, which could be empty. The overall solution is the combination (concatenation) of all these individual lists. To approach this problem: (1) Create a list for holding any solutions. (2) Loop over the characters in letters, and for each character, append it to the end of the current prefix to create a new one. 1 2 (3) Remove the extracted character (which was added to the prefix) from letters to create a new string of letters. (4) Use the newLetters and newPrefix to make a recursive call to anagrams. Add the result to the solutions list created earlier. (5) When there is a single letter left in letters, append the letter to the prefix and then search the word-list for complete candidate word. This constitutes the base case. (6) If the candidate word is in the word-list, append the candidate word to the solutions list and return the solutions. You will need a function to read-in the word-list and a function to search for the candidate word. When a valid solutions list is returned, write it to an output file. Run your program using ‘crate’, using small words 5.txt as your word list (a file containing 5-letter words) and then run petals against small words 6.txt (a file containing 6-letter words) as your word list. Find the running time of your program, for each of the words. To time your program, import time and use start = time.time() before the first function call and stop = time.time() after you have finished writing the (valid) anagrams to a file. The running time is (approximately) stop - start. aaron aback abaft abase abash abate abbey abbot abeam abele abets abhor abide abies abler abode abomb abort about above abuse abuzz abyss accra acers ached aches acids acorn acres acrid acted actor acute adage adapt added adder addle adept adhoc adieu adios adlib adman admen admin admit admix adobe adopt adore adorn adult aegis aeons aesop affix afire afoot afros after again agape agave agent agile aging aglow agony agora agree ahead aided aider aides aimed aimer aired aisle alack alarm album alder alert algae algal alias alibi alien align alike aline alive alkyl allay alley allot allow alloy aloes aloft aloha alone along aloof aloud alpha altar alter amass amaze amber ambit amble amend amens amide amigo amine amino amiss amity amman among amour ample amply amuck amuse andes angel anger angle angry angst anion anise ankle annal annex annoy annul anode antic anvil aorta apace apart apery aphid apian aping apish apnea appal apple apply appro april apron apses apsis aptly arabs araks arbor arced areal areas arena arent argon argot argue argus arias arise armed aroma arose array arrow arson ashen ashes asian aside asked askew aspic assay asses asset aster astir aswan atlas atoll atoms atone attic audio audit auger augur aunts aural auras auric avail avens avers avert avian avoid await awake award aware awash awful awoke axial axing axiom axles axons aztec azure babas babel babes backs bacon baddy bader badge badly baggy bails baits baked baker bakes baldy baled bales balls balms balmy balsa banal bands bangs banjo banks banns barbs bards bared barer bares barge barks barky barns baron barre basal based baser bases basic basil basin basis basks baste batch bated bates bathe baths batik baton batty baulk bawdy bawls bayed beach beads beady beaks beams beamy beans beany beard bears beast beats beaus beaux bebop becks beech beefs beefy beeps beers beery beets befit befog began begat beget begin begot begun beige being belay belch belie belle bells belly below belts bench bends beret bergs berry berth beryl beset besot bests betel bevel bevvy bible bided bides bidet bigot bijou biker bikes biles bilge bills billy bimbo binds binge bingo biota biped birch birds birth bison biter bites bitts bitty blabs black blade blame bland blank blare blase blast blaze bleak bleat bleed bleep blend bless blimp blind blink blips bliss blitz bloat blobs block blocs bloke blond blood bloom blots blown blows bluer blues bluff blunt blurb blurs blurt blush board boars boast boats bobby boded bodes boers bogey boggy bogus boils bolts bombs bonds boned bones boney bongs bonny bonus booby booed books booms boons boors boost booth boots booty booze borax bored borer bores borne boron bosom boson bossy bosun botch bothy bough bound bouts bowed bowel bower bowie bowls boxed boxer boxes brace brags braid brail brain brake brand brans brash brass brats brave bravo brawl brawn brays braze bread break bream breed brews briar bribe brick bride brief brims brine bring brink briny brisk broad broil broke brood brook broom broth brown brows brunt brush brute bucks buddy budge buffs buggy bugle build built bulbs bulge bulgy bulks bulky bulls bully bumps bumpy bunch bunks bunny buoys burly burma burns burnt burps burst buses bushy busts busty butts buxom buyer bylaw bytes byway cabal cabby cabin cable cacao cache cacti caddy cadet cadge cafes caged cages cagey cairn cairo caked cakes calif calls calms calve camel cameo camps canal candy caned canes canny canoe canon caped caper capes capri carat cards cared carer cares cargo carol 1 carps carry carts carve cased cases casks caste casts catch cater cause caved caver caves cease cedar ceded celeb cello cells cents ceres chafe chaff chain chair chalk champ chant chaos chaps charm chars chart chary chase chasm chats cheap cheat check cheek cheep cheer chefs chess chest chews chewy chick chide chief child chili chill chime chimp china chink chins chips chirp chits chock choir choke chomp chops chord chore chose chuck chuff chugs chump chums chunk churn chute cider cigar cilia cinch circa cited cites civic civil claim clamp clams clang clank clans claps clash clasp class claws clays clean clear cleat cleft clerk click cliff climb cling clink clips cloak clock clods clogs clone close cloth clots cloud clout clove clown clubs cluck clued clues clump clung coach coals coast coats coble cobra cocks cocky cocoa coded coder codes codex coils coins colas colds colon colts comas combs comer comes comet comfy comic comma coned cones conga congo conic cooed cooks cools coons coops coped copes copra copse coral cords cores corgi corks corky corns corny corps corse costs couch cough could count coupe coups court coven cover coves covet cowed cower coxed coxes coyly crabs crack craft crags cramp crams crane crank crash crass crate crave crawl craws craze crazy creak cream credo creed creek creel creep creme crepe crept cress crest crete crews cribs crick cried crier cries crime crimp crisp croak crock croft crone crony crook croon crops cross croup crowd crown crows crude cruel crumb crush crust crypt cuban cubed cubes cubic cubit cuffs cuing culls cults cupid curbs curds cured curer cures curia curie curio curls curly curry curse curve curvy cusps cycad cycle cynic cysts czars czech dacha daddy daffy dagga daily dairy daisy dakar dales dally dames damns damps dance dandy danes dante dared dares darns darts dated dates datum daunt david dawns dazed deals dealt deans dears deary death debar debit debts debug debut decaf decay decks decor decoy decry deeds deems deeps defer degas deify deism deist deity delay delhi dells delta delve demon demur denim dense dents depot depth derby desks deter detox deuce devil dials diana diary diced dices dicey didnt diets digit dikes dildo dilly dimer dimes dimly dinar dined diner dines dingo dingy dinky dints diode dirge dirts dirty disco discs dishy ditch ditto ditty divan divas dived diver dives divot dizzy docks dodge dodgy doers doges doggy dogma doily doing doled doles dolls dolly domed domes donga donor donut dooms doors doped dopes dopey dosed doses doted dotes dotty doubt dough douse dover doves dowdy dowel downs downy dowry dowse doyen dozed dozen dozes draft drags drain drake drama drank drape drawl drawn draws drays dread dream drear dregs dress dried drier dries drift drill drily drink drips drive droll drone drool droop drops dross drove drown drugs druid drums drunk dryer dryly duals duchy ducks ducts dudes duels duets dukes dulls dully dummy dumps dumpy dunce dunes duomo duped dupes dusky dusts dusty dutch duvet dwarf dwell dwelt dyers dying dykes eager eagle eared earls early earns earth eased easel eases eaten eater eaves ebbed ebony edema edged edges edict edify edits eerie egged egret egypt eider eight eject eking eland elate elbow elder elect elegy elfin elide elite elope elude elven elves email embed ember emery emirs emits empty enact ended endow enema enemy enjoy ennui enrol ensue enter entry envoy eosin ephor epics epoch epoxy equal equip erase erect ergot erica erode erose erred error erupt essay essen ester ether ethic ethos ethyl evade evens event every evict evils evoke 2 exact exalt exams excel exert exile exist exits expel extol extra exude exult fable faced facer faces facet facia facts faded fades fagot fails faint fairs fairy faith faked fakes falls false famed fancy fangs fanny farad farce fared fares farms fasts fatal fated fates fatty fatwa fault fauna fauns faust fawns faxed faxes fears feast feats fedup feeds feels feign feint fells felon femur fence fends feral ferns ferny ferry fetal fetch feted fetes fetid fetus feuds fever fewer fibre fiche ficus fiefs field fiend fiery fifes fifth fifty fight filch filed filer files filet fills filly films filmy filth final finch finds fined finer fines finis fiord fired firer fires firms first firth fishy fists fitly fiver fives fixed fixer fixes fizzy fjord flabs flack flags flair flake flaky flame flank flans flaps flare flash flask flats flaws fleas fleck flees fleet flesh flick flier flies fling flint flips flirt flits float flock flogs flood floor flops flora floss flour flout flown flows flues fluff fluid fluke flung fluor flush flute flyer foals foams foamy focal focus fogey foggy foils foist folds folio folks folly fonts foods fools foots foray force fords forge forgo forks forms forte forth forts forty forum fossa fouls found fount fours fowls foxed foxes foyer frail frame franc frank fraud frays freak freed freer frees freon fresh frets freud freya friar fried fries frill frisk frock frogs frond front frost froth frown froze fruit fryer fudge fuels fugal fugue fully fumed fumes funds fungi funky funny furls furry furze fused fuses fussy fusty futon fuzzy gable gabon gaffe gaily gains gaits galas gales galls galop gamed games gamma gamut gangs gaols gaped gapes garbs gases gasps gassy gated gates gaudy gauge gauls gaunt gauze gavel gawky gazed gazes gears gecko geeks geese genes genie genii genoa genre gents genus germs ghana ghost ghoul giant gibed gibes giddy gifts gilds gills gilts gipsy girls girth given giver gives glace glade gland glans glare glass glaze gleam glean glebe glenn glens glide glint gloat globe gloom glory gloss glove glows glued glues gluey gluon glyph gnarl gnash gnats gnaws gnome goads goals goats godly goers gofer going golds golly gonad gongs goods goody gooey goofs goofy goons goose gored gores gorge gorse goths gouda gouge gourd gowns grabs grace grade graft grail grain grams grand grant grape graph grasp grass grate grave gravy graze great greed greek green greet greys grids grief grill grime grimm grimy grind grins gripe grips grist grits groan groat groin groom grope gross group grout grove growl grown grows grubs gruel gruff grunt guano guard guava guess guest guide guild guile guilt guise gulfs gulls gully gulps guppy gurus gusto gusts gusty gutsy gypsy habit hacks hades hadnt hafts haiku hails hairs hairy haiti hakea hallo halls halon halts halve hands handy hangs hanoi happy hardy hared harem hares harks harms harps harry harsh harts hasnt haste hasty hatch hated hater hates hauls haunt haven haves havoc hawks haydn hazel heads heady heals heaps heard hears heart heath heats heave heavy hedge heeds heels hefty heirs heist helen helix hello hells helms helps heman hemen hence henge henna henry herbs herds herod heron hertz hewed hewer hexed hider hides highs hight hiked hiker hikes hills hilly hilts hindu hinge hinny hints hippo hippy hired hirer hires hitch hived hives hoard hoary hobby hocks hocus hoggs hoist holds holed holes holly homed homes honed hones honey honks hoods hoofs hooks hooky hoops hoots hoped hopes horde horns horny horse hosed hoses hosta hosts hotel hotly hound hours house hovel hover howdy howls hubby huffy hulks hullo hulls human humid humps humus hunch hunks hunts hurls hurry hurts husks husky hussy hutch hydra hydro hyena hymen 3 hymns ibsen icier icily icing icons idaho ideal ideas idiom idiot idled idler idles idols idyll igloo ileum iliad image imago imams imbue impel imply inane incas incur index india inept inert infer infix infra ingot inked inlaw inlay inlet inner input inset inter intro inuit inure ionic iotas iraqi irate irish irked irons irony islam isles islet issue italy itchy items ivies ivory jacks jacob jaded jades jails jambs james janus japan japes jaunt jawed jazzy jeans jeeps jeers jehad jelly jemmy jerks jerky jests jesus jetty jewel jiffy jihad jilts jimmy jingo jinks jived jives joins joint joist joked joker jokes jokey jolly jolts jonah joule joust jowls joyed judas judge juice juicy julep jumbo jumps jumpy junks junta juror kalif karma karst kayak kebab keels keeps kelts kenya kerbs ketch keyed khaki khans kicks kills kilns kilts kinds kings kinks kinky kiosk kites kitty kiwis klick kloof knack knave knead kneed kneel knees knell knelt knife knits knobs knock knoll knots known knows koala kongo koran korea kraal kraft krill kudus label labia laced laces lacks laden ladle lager lagos laird lairs laity lakes lamas lambs lamed lamps lance lands lanes lanky lapel lapse larch lards large largo larks larva laser lasso lasts latch later latex lathe laths latin lauds laugh lavas lawns laxer layby layer lazed leach leads leafy leaks leaky leans leant leaps leapt learn lease leash least leave ledge leech leeds leeks leers lefts lefty legal leggy lemma lemon lemur lends lenin lento leone leper level lever liars libel libya lichi licks liens lifts light liked liken likes lilac limbo limbs limes limit limps lined linen liner lines links lions lipid lisps lists lithe litre lived liven liver lives livid llama loads loafs loams loamy loans loath lobby lobed lobes local lochs locks locus lodge loess lofts lofty logic logos loins loire lolly loner longs looks looms loony loops loopy loose loots loped lopes lords lorry loser loses lotto lotus louis louse lousy louts loved lover loves lower lowly loyal lucid lucky lucre lulls lumen lumps lumpy lunar lunch lunge lungs lupin lurch lured lures lurex lurid lurks lusts lusty lutes luxor lying lymph lynch lyons lyres lyric macaw maces macho macro madam madly mafia magic magma maids mails maims maine mains maize major maker makes malay males malls malta malts malty malva mamas mamba mammy maned manes mange mango mania manic manly manna manor manse maori maple march mares maria marks marls marry marsh maser masks mason masts match mated mater mates maths matte mauls mauve maxim mayas maybe mayor mazes meals mealy means meant meany meats meaty mecca medal media medic meets melee melon melts mends menus meows mercy merge merit merry meson messy metal meted meter metre metro miami micro midas midge midst might mikes milan miler miles milks milky mills mimed mimes mimic mince minds mined miner mines minim minke minks minor mints minty minus mired mires mirth miser missy mists misty mites mitre mitts mixed mixer mixes mixup moans moats mocks modal model modem modes mogul moist molar molds moldy moles molts money monks month moods moody mooed moons moors moose moped mopes moral moray mores morns moron morph morse moses mossy motel motes motet moths motif motor motto mould moult mound mount mourn mouse mousy mouth moved mover moves movie mowed mower mucks mucky mucus muddy muffs mufti muggy mulch mules mummy mumps munch muons mural murky mused muses mushy music musks musky musts musty muted mutes mutts muzak myope myrrh myths nadir naiad nails naive naked named names nanny naomi 4 nappy nasal nasty natal naval navel navvy nazis nears necks needs needy negev neigh nepal nerds nerve nervy nests netts never newer newly newsy newts nguni nicer niche nicks niece nifty niger night nines ninny ninth nixon noble nobly nodal noddy nodes nohow noise noisy nomad nooks noons noose norms north nosed noses nosey notch noted notes nouns novel nudes nudge nulls numbs nurse nutty nyala nylon nymph oaken oakum oases oasis oaths obese obeys oboes occur ocean ochre octal octet odder oddly odium odour offal offer often ogled ogres ohmic oiled oiler oinks okapi okays olden older oldie olive omega omens omits onion onset oozed oozes opals opens opera opine opium opted optic orang orate orbit order organ oscar other otter ought ounce ousts outdo outer outgo ovals ovary ovate ovens overs overt ovoid owing owlet owned owner oxide ozone paced pacer paces pacey packs pacts paddy padre paean pagan paged pager pages pails pains paint pairs paled paler pales palls palms palmy palsy panda paned panel panes panga pangs panic pansy pants papal papas papaw paper pappy papua parch pared pares paris parka parks parry parse parts party passe pasta paste pasts pasty patch paten pater pates paths patio pause paved paves pawed pawns payed payee payer peace peach peaks peaky peals pearl pears peaty pecan pecks pedal peeks peels peeps peers pekan pelts penal pence penny perch peril perks perky perms perry perth pesky pests petal peter petit petty phase phlox phone phony photo phyla piano picks piece piers pieta piety piggy pikes piled piles pills pilot pimps pinch pined pines pings pinks pinky pints pinup pions pious piped piper pipes pipit pique pitch piths pithy piton pivot pixel pixie pizza place plaid plain plait plane plank plans plant plasm plate plato plays plaza plead pleas pleat plebs plied plies plods plops plots ploys pluck plugs plumb plume plump plums plumy plush pluto poach pocks podgy podia poems poets point poise poked poker pokes polar poled poles polio polka polls polyp ponce ponds pooch pools popes poppy popup porch pored pores porky porno porns ports posed poser poses posit posse posts potch potty pouch poult pound pours pouts power prams prang prank prawn prays preen preps pr...
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

View attached explanation and answer. Let me know if you have any questions.

aaron aback abaft abase abash abate abbey abbot abeam abele abets abhor abide
abies abler abode abomb abort about above abuse abuzz abyss accra acers ached
aches acids acorn acres acrid acted actor acute adage adapt added adder addle
adept adhoc adieu adios adlib adman admen admin admit admix adobe adopt
adore adorn adult aegis aeons aesop affix afire afoot afros after again agape agave
agent agile aging aglow agony agora agree ahead aided aider aides aimed aimer
aired aisle alack alarm album alder alert algae algal alias alibi alien align alike
aline alive alkyl allay alley allot allow alloy aloes aloft aloha alone along aloof
aloud alpha altar alter amass amaze amber ambit amble amend amens amide
amigo amine amino amiss amity amman among amour ample amply amuck
amuse andes angel anger angle angry angst anion anise ankle annal annex annoy
annul anode antic anvil aorta apace apart apery aphid apian aping apish apnea
appal apple apply appro april apron apses apsis aptly arabs araks arbor arced
areal areas arena arent argon argot argue argus arias arise armed aroma arose
array arrow arson ashen ashes asian aside asked askew aspic assay asses asset
aster astir aswan atlas atoll atoms atone attic audio audit auger augur aunts
aural auras auric avail avens avers avert avian avoid await awake award aware
awash awful awoke axial axing axiom axles axons aztec azure babas babel babes
backs bacon baddy bader badge badly baggy bails baits baked baker bakes baldy
baled bales balls balms balmy balsa banal bands bangs banjo banks banns barbs
bards bared barer bares barge barks barky barns baron barre basal based baser
bases basic basil basin basis basks baste batch bated bates bathe baths batik
baton batty baulk bawdy bawls bayed beach beads beady beaks beams beamy
beans beany beard bears beast beats beaus beaux bebop becks beech beefs beefy
beeps beers beery beets befit befog began begat beget begin begot begun beige
being belay belch belie belle bells belly below belts bench bends beret bergs
berry berth beryl beset besot bests betel bevel bevvy bible bided bides bidet
bigot bijou biker bikes biles bilge bills billy bimbo binds binge bingo biota biped
birch birds birth bison biter bites bitts bitty blabs black blade blame bland blank
blare blase blast blaze bleak bleat bleed bleep blend bless blimp blind blink blips
bliss blitz bloat blobs block blocs bloke blond blood bloom blots blown blows
bluer blues bluff blunt blurb blurs blurt blush board boars boast boats bobby
boded bodes boers bogey boggy bogus boils bolts bombs bonds boned bones
boney bongs bonny bonus booby booed books booms boons boors boost booth
boots booty booze borax bored borer bores borne boron bosom boson bossy
bosun botch bothy bough bound bouts bowed bowel bower bowie bowls boxed
boxer boxes brace brags braid brail brain brake brand brans brash brass brats
brave bravo brawl brawn brays braze bread break bream breed brews briar bribe
brick bride brief brims brine bring brink briny brisk broad broil broke brood
brook broom broth brown brows brunt brush brute bucks buddy budge buffs
buggy bugle build built bulbs bulge bulgy bulks bulky bulls bully bumps bumpy
bunch bunks bunny buoys burly burma burns burnt burps burst buses bushy
busts busty butts buxom buyer bylaw bytes byway cabal cabby cabin cable cacao
cache cacti caddy cadet cadge cafes caged cages cagey cairn cairo caked cakes
calif calls calms calve camel cameo camps canal candy caned canes canny canoe
canon caped caper capes capri carat cards cared carer cares cargo carol 1
1

carps carry carts carve cased cases casks caste casts catch cater cause caved
caver caves cease cedar ceded celeb cello cells cents ceres chafe chaff chain chair
chalk champ chant chaos chaps charm chars chart chary chase chasm chats cheap
cheat check cheek cheep cheer chefs chess chest chews chewy chick chide chief
child chili chill chime chimp china chink chins chips chirp chits chock choir choke
chomp chops chord chore chose chuck chuff chugs chump chums chunk churn
chute cider cigar cilia cinch circa cited cites civic civil claim clamp clams clang
clank clans claps clash clasp class claws clays clean clear cleat cleft clerk click
cliff climb cling clink clips cloak clock clods clogs clone close cloth clots cloud
clout clove clown clubs cluck clued clues clump clung coach coals coast coats
coble cobra cocks cocky cocoa coded coder codes codex coils coins colas colds
colon colts comas combs comer comes comet comfy comic comma coned cones
conga congo conic cooed cooks cools coons coops coped copes copra copse coral
cords cores corgi corks corky corns corny corps corse costs couch cough could
count coupe coups court coven cover coves covet cowed cower coxed coxes coyly
crabs crack craft crags cramp crams crane crank crash crass crate crave crawl
craws craze crazy creak cream credo creed creek creel creep creme crepe crept
cress crest crete crews cribs crick cried crier cries crime crimp crisp croak crock
croft crone crony crook croon crops cross croup crowd crown crows crude cruel
crumb crush crus...


Anonymous
I was stuck on this subject and a friend recommended Studypool. I'm so glad I checked it out!

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4