Programs for "Man In Hole" story lines
--D. Thiebaut (talk) 07:33, 27 March 2015 (EDT)
Programs demonstrated in class during Week #8
week8.py
# Week 8 Programs # D. Thiebaut import random # constants for possible outcomes HUMANWINS = 1 COMPUTERWINS = 2 TIE = 0 # compare2Lists: given 2 lists with the same number of items # count the number of items common to both lists, and appearing # at the same index in both. def compare2Lists(): # 0 1 2 3 4 items1 = [ "dog", "cat", "horse", "hen", "pig"] items2 = [ "dog", "pig", "pigeon", "hen", "cat"] count = 0 for i in range( len( items1 ) ): for j in range( len( items2 ) ): print( "i =", i, "j=", j ) if items1[i]==items2[j]: count += 1 print( "match!" ) print( count ) # guessingGame: computer picks a number, and the user # tries to guess it. def guessingGame(): tooLow = ["Nope, too low...", "Try something higher...", "Higher next time..." ] tooHigh = ["Think of a smaller number...", "Nope, too high...", "Oh my! Not that high!" ] # computer picks a random number between 1 and 100 (included) secret = random.randrange( 1, 101 ) # loop as long as user doesn't guess right... while True==True: guess = int( input( "Pick a number between 1 an 100: " ) ) if guess==secret: print( "Congrats, that was my secret number:", secret ) break if guess < secret: print( random.choice( tooLow ) ) else: print( random.choice( tooHigh) ) # winner(): compares human play to computer play # applies rules of Rock Paper Scissors, and returns # the winner as HUMANWINS, COMPUTERWINS, TIE. # comp hum winner # R R tie # R S comp # R P hum # S R hum # S S tie # S P comp # P R comp # P S hum # P P tie def winner( human, computer ): if computer==human: return TIE """ if ( computer=="R" and human=="S" or computer=="S" and human=="P" or computer=="P" and human=="R" ): return COMPUTERWINS """ play = computer+human # "PR", "RS", etc... if play in [ "RS", "SP", "PR" ]: return COMPUTERWINS else: return HUMANWINS def getInput( ): ans = input( "\nyour play? " ).upper() while (ans in [ "R", "P", "S" ]) == False: ans = input( "Invalid input. Try again: " ).upper() return ans # rockPaperScissors: plays a game of Rock Paper Scissors, # user against computer. def rockPaperScissors(): # initialize counters humanScore = 0 computScore = 0 # play for 10 rounds for i in range( 10 ): computer = "R" human = getInput( ) result = winner( human, computer ) if result == HUMANWINS: print( "You win! I had picked", computer ) humanScore += 1 elif result == COMPUTERWINS: print( "I WIN! I had picked", computer ) computScore += 1 else: print( "We're tied! I had picked", computer ) print( "Human:", humanScore, " Computer:", computScore ) # announce the winner if humanScore > computScore: print( "-"*30, "\nYOU ROCK! You beat me by", humanScore-computScore, "points\n\n" ) elif computScore > humanScore: print( "-"*30, "\nYou're a disgrace to humanity... I beat you by", computScore-humanScore, "point(s)\n\n" ) else: print( "-"*30, "\nI'm amazed you managed to tie with me!\n", "We both have", computScore,"point(s)\n\n" ) def main(): #guessingGame() rockPaperScissors() main()
week8_2.py
# week8_2.py # D. Thiebaut # program written in class on 3/25/15 # First function is a guessing game # Second function is a game of rock-paper-scissors # import random # plays a game. Picks a random number (1-100). Asks the # user to guess what it is, and reports if too low, to high, # or match. def guessingGame(): computer = 50 # random.randrange( 1, 101) # friendly explanations print( "Let's play... guess the number I picked..." ) while True==True: # get user's guess # report on too low or too high user = int( input( "Enter a number between 1 and 100> " ) ) # compare user's guess to computer pick if user == computer: print( "You guessed it!\nI had picked", computer ) break else: if user < computer: print( "Too low!" ) else: print( "Too high!" ) # winner: given two letters that are "R", "P" or "S", # apply the rules of Rock, Paper, Scissors to indicate # which one wins. Returns COMPUTERWINS if first letter # wins, USERWINS if second letter, and TIE if neither. def winner( computer, user ): TIE = "TIE" COMPUTERWINS = "COMPUTERWINS" USERWINS = "USERWINS" # do we have a tie? if computer==user: return TIE # if not, figure out who wins and return the appropriate # constant if ( computer=="R" and user=="S" or computer=="S" and user=="P" or computer=="P" and user=="R" ): return COMPUTERWINS else: return USERWINS # playRockPaperScissors: plays a whole game def playRockPaperScissors(): # define constants TIE = "TIE" COMPUTERWINS = "COMPUTERWINS" USERWINS = "USERWINS" # initialize variables computCount = 0 userCount = 0 # play the game while True==True: # pick a random letter for the computer computer = random.choice( [ "R", "S", "P" ] ) # get the user input (careful, this is totally not robust!) # the user can enter anything she wants... user = input( "\n\nYour play? " ).upper() # Report outcome to the user if winner( computer, user )==TIE: print( "It's a tie!" ) else: if winner( computer, user )==COMPUTERWINS: print( "I win! I had picked", computer ) computCount += 1 else: print( "You win! I had picked", computer ) userCount += 1 # print scores: print( "Scores: user:", userCount, " computer:", computCount ) def main(): #while True: # guessingGame() # ans = input( "Play again (Y/N)? " ) # if not ans in [ "y", "Y", "yes", "YES" ]: # break playRockPaperScissors() main()
manInHole.py
# manInHole.py # D. Thiebaut # list of words that are sad/pleasant/happy... can be found here: # http://www.psychpage.com/learning/library/assess/feelings.html import happySadWords # the module with 2 lists of happy and sad # words: pleasantWords, and unpleasantWords import urllib.request # the lib that handles the url stuff # getBook: given a URL of a book on a site, such as # the gutenberg.org site, retrieve the book and return # its content as a string def getBook( url ): # split http://cs.smith.edu/~thiebaut/classes/111/books/MobyDick.txt # and keep the MobyDick.txt part fileName = url.split( "/" )[-1] # fetch the file and put its contents in the # string text. response = urllib.request.urlopen( url ) text = response.read().decode( 'UTF-8' ) return text # removePunctuation # remove the punctuation mark from the text def removePunctuation( text ): for c in """'!"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~'""": text = text.replace( c, " " ) return text # countHappySadWords # counts the number of happy and sad (positive and negative) # words in the text def countHappySadWords( words ): happy = 0 sad = 0 for word in words: if word in happySadWords.pleasantWords: happy += 1 if word in happySadWords.unpleasantWords: sad += 1 return happy, sad # generateCSVFile # given a list of words from the book, and a file name # record a time line of the variation of a counter that # goes +1 every time a happy word is found, and -1 whenever # a negative word is found. The result is stored in a file. # Each line contains 2 numbers separated by a comma. The # first number is the location of the happy/sad word in the # book, the second is the value of the happy/sad counter for # that word. def generateCSVFile( outputFileName, words ): countWords = 0 countHapSad = 0 file = open( outputFileName, "w" ) for i in range( len( words ) ): word = words[i] countWords += 1 if word in happySadWords.pleasantWords: countHapSad += 1 file.write( "{0:1}, {1:1}\n".format( countWords, countHapSad ) ) if word in happySadWords.unpleasantWords: countHapSad -= 1 file.write( "{0:1}, {1:1}\n".format( countWords, countHapSad ) ) file.close() # ----------------------------------------------------------- # main program # ----------------------------------------------------------- def main(): # initialize happySadWords.initLists() #url="http://cs.smith.edu/~thiebaut/classes/111/books/DorianGray.txt" #title = "The Picture of Dorian Gray" url="http://cs.smith.edu/~thiebaut/classes/111/books/MobyDick.txt" title = "Moby Dick" fileName = url.split("/")[-1] #--- get the text of the book --- text = getBook( url ) #print( text[0:1000] + "\n" ) #--- clean up the text --- text = removePunctuation( text ).lower() #--- get the individual words --- words = text.split( ) #--- display some information (just to be sure) --- print( "Number of words: ", len( words ) ) #print( " ".join( words[0:1000] ) ) #--- get happy/sad statistics --- """ happy, sad = countHappySadWords( words ) print( title ) print( "Number of happy words: ", happy ) print( "Number of sad words: ", sad ) """ #--- generate data --- generateCSVFile( fileName.replace(".txt", "")+".csv", words ) main()
happySadWords.py
# happySadWords.py # # list of words that are sad/pleasant/happy... can be found here: # http://www.psychpage.com/learning/library/assess/feelings.html # this program takes the cut and pasted portion of the web page # that is in triple double quotes and generates 2 list of words # one for positive feelings one for negative feelings. # # Added more negative words found here: # http://www.enchantedlearning.com/wordlist/negativewords.shtml # # Added more postive words found here: # http://positivewordsresearch.com/list of positive words/ import random pleasant="""OPEN HAPPY ALIVE GOOD understanding great playful calm confident gay courageous peaceful reliable joyous energetic at ease easy lucky liberated comfortable amazed fortunate optimistic pleased free delighted provocative encouraged sympathetic overjoyed impulsive clever interested gleeful free surprised satisfied thankful frisky content receptive important animated quiet accepting festive spirited certain kind ecstatic thrilled relaxed satisfied wonderful serene glad free and easy cheerful bright sunny blessed merry reassured elated jubilant LOVE INTERESTED POSITIVE STRONG loving concerned eager impulsive considerate affected keen free affectionate fascinated earnest sure sensitive intrigued intent certain tender absorbed anxious rebellious devoted inquisitive inspired unique attracted nosy determined dynamic passionate snoopy excited tenacious admiration engrossed enthusiastic hardy warm curious bold secure touched brave sympathy daring close challenged loved optimistic comforted re enforced drawn toward confident hopeful ABLE ACCEPT ACCEPTANCE ACCEPTABLE ACCEPTED ACCEPTING ACTION ACTIVATE ACTIVE ADD ADDITION ADMIRABLE ADORABLE ADVANTAGE AFFIRM AGELESS AGREE AGREEABLE AID AIM ABUNDANCE ACCOUNTABILITY ACCOMPLISHMENT ACCOMPLISH ACCURACY ACHIEVEMENT ACHIEVE ACKNOWLEDGEMENT ADAPTABILITY ADVENTURE ADVENTUROUS AGILITY ALERTNESS AMBITION ANTICIPATION APPRECIATE APPRECIATION APPRECIATIVE APPRECIATIVENESS ASSERTIVENESS ASSERTIVE ATTENTIVENESS AUDACITY AWARE AWARENESS AUTHENTIC AUTHENTICITY ABRACADABRA ATTRACTION ALLOW ALLOWING AFFECTION AFFECTIONATE ABSORBED ALERT AMAZED AWE AWED ANIMATE ANIMATED ANIMATING ANIMATION ANIMATENESS ARDENT AMAZING AWESOME AWESOMENESS AROUSED ASTONISHED ASTONISHING AMUSED AIR AIRNESS ALOHA ADORE ADMIRE ADMIRABLE ALLURE ANGEL ANGELIC ALTRUISM ALTRUISTIC ABOUNDING ABSOLUTE ABSOLUTELY ACCESSIBLE ACCLAIMED ACCOMMODATE ACCOMMODATED ACCOMMODATION ACCOMMODATING AMPLE APPRECIATIVE JOY AMIN ACCENTUACTIVITY ACTABILITY AFFABLE ALACRITY ALTRUCAUSE AMIABLE ASTOUNDING ATTRACTIVE ALIVE ALIVENESS BEATIFY BEATITUDE BENEFICIAL BENEFIT BENEVOLENT BELOVED BEST BETTER BLESS BLESSING BLESSED BLISS BLISSFULNESS BLISSFUL BLOOM BLOSSOM BALANCE BALANCED BEAUTY BEAUTIFUL BELONG BELONGING BOLDNESS BRAVERY BRILLIANCE BRILLIANT BLISS ON TAP BEYOND FABULOUS BIOPHILIA BRIGHT BRIGHTNESS BALISTIC BLASTING BLAZING BLINDING BREATHTAKING BUBBLING BUSTING BLISSCIPLINE BUYANCY BULLISHNESS BRISKNESS BUOYANCY BREEZINESS BRIO CARE CARING CALM CREATE CREATIVE CREATIVITY CREATIVENESS CAPABLE CAPABILITY CELEBRATE CELEBRATION CERTAIN CERTAINTY CHARITABLE CHARITY CHARM CHARMING CHARMER CHOICE CLEAN CLEANLINESS COMFORT COMFORTABLE COMFORTING CALM CUDDLE CUDDLING CANDOR CAREFULNESS CHALLENGE CHANGE CHEERFUL CHEERFULNESS CLARITY COLLABORATION COMMITMENT COMMUNICATION COMMUNITY COMPASSION COMPASSIONATE COMPETENT COMPETENCE COMPETENCY CONCENTRATION CONFIDENT CONFIDENCE CONSCIOUSNESS CONSISTENCY CONSISTENT CONTENT CONTENTMENT CONTINUITY CONTINUOUS CONTRIBUTION CONVICTION CONVINCING COOPERATION COURAGE COURTESY COURTEOUS CURIOUS CURIOSITY CHAKRA COOL CLEAR HEADED CENTERED CLOSENESS COMPANIONSHIP CONSIDERATE CONSIDERATION COMMUNION CONNECT CONNECTED CONNECTION CONNECTEDNESS CONQUER CUTE CHARISMA CHARISMATIC COLLECTED CHEERFUL WILLINGNESS CHEERS CONGRUENCE CORDIAL CRANK (UP) CAPITAL DIRECTION DELICATE DECENT DESIRABLE DELICIOUS DELICIOUSNESS DO DREAM DREAMY DYNAMIC DARING DECISIVENESS DELIGHT DELIGHTED DELIGHTFUL DEPENDABILITY DESIRE DETERMINATION DEVOTION DIGNITY DILIGENCE DISCIPLINE DISCOVERY DISCRETION DIVERSITY DRIVE DUTY DIVINE DAZZLED DISNEY DEVOTED DANDY DAIMON DEBONAIR DETACHMENT EMPATHY EMPATHIZE EMPHATIC EASY EASILY EDUCATE EDUCATION EDUCATED EFFICIENT ENABLE ENABLED ENERGETIC ENERGIZE ENERGY ENGAGE ENGAGING ENGAGED ENJOY ENJOYMENT ENOUGH EAGER EAGERNESS EFFECTIVENESS EFFICIENCY ELATION ELEGANCE ENCOURAGE ENCOURAGEMENT ENCOURAGED ENDURANCE EQUALITY EXCELLENCE EXCELLENT EXCITE EXCITEMENT EXCITED EXPERIENCE EXPERTISE EXPLORATION EXPRESSIVENESS EXPRESSING ENLIGHTENMENT ETERNAL EXALTATION EMULATE EMPOWER EMPOWERING EMPOWERED EXPANSIVE EXHILARATING ENTHUSIASTIC ENTHUSIASM ENGROSSED ENCHANTED ENTRANCED ECSTATIC ELATED ENTHRALLED EXUBERANT EXUBERANCE EXPECTANT EQUANIMOUS ENLIVENED EFFICACY EASE EXEMPLARY EXTRAORDINARY EARNEST ELEVATE ELEVATED EQUANIMITY EASE OF MIND EXCITED ANTICIPATION EXTRA EQUITY EQUITABLY EQUITABLE EAGLEMAN EASY TO TALK TO EASY TO APPROACH ECSTATIFY EUDAEMONISM EUDAEMONIST EUDAEMONISTIC EUDAIMONIA EUDAMONIA EVOLVE EXALTING EXSTATISFY EXULTANT ASTRONOMICAL CHAMPION CHAMP’ ELECTRIC ENORMOUS EXCEPTIONAL EXCITING EXQUISITE EFFORTLESSNESS EUNOIA ECOSOPHY EBULLIENCE FANTASTIC FEEL GOOD FEELING GOOD FLOW FLOWING FABULOUS FAIR FAITH FAITHFUL FAME FAVORITE FAIRNESS FAMILY FIDELITY FLEXIBILITY FOCUS FLOURISH FORGIVE FORGIVING FORGIVENESS FORTITUDE FREE FREEDOM FRUGALITY FUN FUTURE FRIEND FRIENDLY FRIENDSHIP FRIENDLINESS FASCINATE FASCINATED FULFILL FULFILLED FOOD FEISTY FEISTINESS FESTIVE FEASIBLE FINE FEARLESS FESTIVE FESTIVENESS FIT FANTABULOUS FREECYCLE FUNERIFIC FUNOLOGY FLAWLESS GLOW GENEROUS GENEROSITY GENERATE GENIAL GENIUS GENUINE GIFT GIVE GIVING GOOD GOODNESS GIVING GOING THE EXTRA MILE GRACE GRATITUDE GRATEFULNESS GROW GROWTH GUIDE GUIDING GUIDANCE GOD GROUNDED GLORY GODLINESS GOOD FEELING GROOVY GIDDY GLAD GOOD HEALTH GLAMOR GIGGLING GODDESS GORGEOUS GORGEOUSNESS GRANDIOSITY GENERAVITY GENTLEMAN GARGANTUAN GRAND GREAT GINGER HOPE HOPEFULNESS HAPPINESS HAPPY HAPPILY HARMONIOUS HARMONIZE HARMONY HEALTH HEALTHY HEART HELLO HELP HELPFUL HELPING HOT HONEST HONESTY HUMAN HUMOR HELPFULNESS HERO HEROISM HOLY HOLINESS HONESTY HONOR HOSPITALITY HUMBLE HEAVEN HEAVENLY HALO HEARTFELT HEARTWARMING ONE POINTEDNESS HAPPY HEARTED HEEDFUL HANDSOME HUGE HIGH SPIRITEDNESS IMAGINATION INSPIRE INSPIRATION INSPIRED INSPIRATIONAL IN LOVE IDEA INCREDIBLE INNOVATE INNOVATION INTERESTING INTEREST INTERESTED IMPROVEMENT INDEPENDENCE INFLUENCE INGENUITY INNER PEACE INSIGHT INSIGHTFULNESS INSIGHTFUL INTEGRITY INTELLIGENCE INTELLIGENT INTENSITY INTIMACY INTUITIVENESS INVENTIVENESS INVESTING INTENTION INVIGORATE INVIGORATED INTRIGUED INVOLVE INVOLVED INCLUSION INNOCENT INEFFABLE INTREPID IDEALISM ILLUMINATION ILLUMINATED INCOMPARABLE INVINCIBLE INQUISITIVE INFINITE INFINITY JOY JOYFUL JOYOUS JOKE JOLLY JOVIAL JUST JUSTICE JUBILANT JUVENESCENT JUMPY JAMMIN’ JUBILINGO KINDNESS KIND KIND HEART KINDLY KEEP UP KISS KNOWLEDGE KITTENS KEEN LIKE LAUGH LAUGHING LEARN LEARNING LIFE LIVE LIVING LUXURY LONGEVITY LOYALTY LOYAL LOVE LOVABLE LOVING LIBERTY LOGIC LEADER LEADERSHIP LUCK LUCKY LIGHT LOVING KINDNESS LIVELY LIFE OF THE PARTY LOVELY LOVING ACCEPTANCE LOVING FEELINGS LIGHTWORKER MEANING MEANINGFUL MORE MAGNIFICENT MAJESTY MANY MARVELOUS MERIT MOTIVATE MIRACLE MAGIC MAKING A DIFFERENCE MASTERY MATURITY MEANING MERIT MINDFUL MINDFULNESS MODESTY MOTIVATION MOTIVATIONAL MERCY MEDITATION MIND BLOWING MELLOW MOVED MOVEMENT MUTUALITY MOURNING MELIORISM MENCH MIDSIGHT MINDSIGHT MAJOR NOBLE NURTURING NURTURE NON RESISTANCE NON RESISTANT NEW NICE NIRVANA NOBLE NEAT NATURE MADE NOURISH NOURISHED NOURISHING NOURISHMENT NAMASTE NEOTENY OPTIMIST OPTIMISTIC OUTSTANDING OK ON ONWARDS OPEN OPENLY OPENING OPEN MINDED OPPORTUNITY ORIGINAL OPENNESS OPPORTUNITY OPTIMISM ORDER ORGANIZATION ORIGINALITY OUTCOME ORIENTATION OBEDIENT OPEN HEARTED OMG OVERCOME OM MANI PADME HUM OUTGOING ONENESS OUTERNATIONALIST PERFECT PERFECTION POSITIVE ENERGY POSITIVE THOUGHTS POSITIVE EVENTS POSITIVE CIRCUMSTANCES POSITIVE BELIEFS PEACE PACIFY PARADISE PARADISIAC PASSION PASSIONATE PLEASE PURE PEACE PERCEPTIVENESS PERSEVERANCE PERSISTENCE PERSONAL GROWTH PLEASURE POSITIVE ATTITUDE POSITIVE WORDS POWER POWERFUL PRACTICALITY PRECISION PREPAREDNESS PRESENCE PRESERVATION PRIVACY PROACTIVITY PROACTIVE PROGRESS PROSPERITY PROSPEROUS PUNCTUALITY PUNCTUAL PATIENCE PROUD PLEASED PRESENCE PLAY PLAYFUL PLAYFULNESS PARTICIPATION PURPOSE PICK ME UP PRONIA PIOUS PUPPIES POLITE POSITIVE MIND POSITIVE THINKING POSITIVE WORDS PRETTY PRECIOUS PARDON PERKINESS PIQUANCY POSICHOICE POSIDRIVING POSIFIT POSILENZ POSIMASS POSIMINDER POSIRATIO POSIRIPPLE POSIRIPPLER POSIRIPPLES POSISINGER POSISITE POSISTRENGTH POSITIBILITARIAN POSITRACTION POSITUDE POSIVALUES POSIWORD POSSIBILITARIAN PROMPTNESS PROTO PRICELESS PEP PEPPINESS QUALITY QUIET QUIETNESS QUAINT QUIESCENT QUEENLY QUICKENING QUIDDITY RESPECT RADIANT READY READINESS REAL REALITY REASON RECOMMEND REFRESH REFRESHED RELAX RELAXED RELIEF RELIEVE RELIEVED REMARKABLE RATIONALITY RECOGNITION RELATIONSHIPS RELIABLE RELIABILITY RELIGION RESOURCEFULNESS RESPECT RESPONSIBILITY RIGHTEOUSNESS RISK TAKING ROMANCE REVELATION REVIVED RESTORE RESTORED REST RESTED RENEW RENEWED REJUVENATE REJUVENATED RAPTURE RAPTUROUS RESILIENT RESILIENCE REVERENCE RIPE REBORN RELATEDNESS RASASVADA REPOSE ROSINESS SCOPE SMILE SMILING SOULMATE SOUL SOULFUL SACRED SAFE SAFETY SECURE SECURED SECURITY SUSTAIN SUSTAINED SAVE SAVINGS SIMPLE SIMPLIFY SELFLESSNESS SELF ESTEEM SERVICE SIMPLICITY SINCERITY SKILL SKILLED SPIRIT SERENE SERENITY STABILITY STRENGTH STYLE SYSTEMATIZATION SELF LOVE STRIVE SERVICE SALVATION SELF RESPECT SELF FORGIVENESS SERVE SYMPATHETIC SELF COMPASSION SELF KINDNESS SPELLBOUND STIMULATED STIMULATING STIMULATION SATISFIED STILL SURPRISED SLEEP SEXUAL EXPRESSION SHELTER SELF EXPRESSION STABILITY SUPPORT SPACE SPACIOUS SPONTANEITY SPONTANEOUS SUNSHINE SPARK SPARKLE SPARKLES SWEET SWEETNESS SUPPORT SUPPORTING SUPPORTED SEXY SEXINESS SUPREME SUCCULENT SWEETHEART STUDY STUDIOUS SELFLESSNESS SAVOUR SAVOURING SUFFICIENT STUPENDUOS SWAG SWAGGY SPLENDID SMART SPECTACULAR SPECIAL SERENDIPITY SYNERGY SHINE SHINING START STEADFASTNESS SUBLIME SUNNINESS SWEET SUPERPOWER TRUE TRUST TRUSTING TACT TEACH TEACHABLE TEAM THANKFUL THANK THANK YOU THANKFULNESS THERAPY TIME TEAMWORK TIMELINESS TOLERANCE TRADITION TRANQUIL TRANQUILITY TRUST TRUTH TRUTHFULNESS TENDER THRILLED TOUCH TOUCHED TICKLED TO MATTER TO KNOW TO BE KNOWN TO BE SEEN TRANSFORMATIVE TRANSFORMATION TRANSFORM TRIUMPH TEAMWORK THRIVE THRIVING TENACITY UNIFICATION UNIQUE UPLIFT ULTIMATE UNCONDITIONAL UPGRADE USEFUL USER FRIENDLY UNITY UNDERSTAND UNDERSTANDING UNDERSTOOD UNIFICATION OF MIND UP UPOWER UPSKILL VITALITY VALUE VALUES VALUABLE VIRTUOUS VALID VERIFY VERY VIABLE VIRTUE VICTORY VICTORIOUS VARIETY VULNERABILITY VULNERABLE VIBRANT VOW VIM VIGOR VENERATION VOCABULEVERAGE WORTH WORTHY WORTHINESS WEALTH WARM WARMTH WELCOME WILL WILLING WILLINGNESS WISDOM WISE WON WONDERFUL WELL BEING WHOLEHEARTEDNESS WOW WONDER WATER WELL WELLNESS WELFARE WHOLE WONDER WORKING WIN WINNABLE WINNING XO X RAY VISION XENOPHILIA XENODOCIAL Xfactor XENOPHILE XENIAL YES YOUTH YOUTHFUL YOUNG YOUNG AT HEART YIPPEE YAY YEARN YEA YEAH YUMMY YEN YESABILITY YUGEN ZEALOUS ZEAL ZEST ZESTY ZESTFUL ZIPPY ZING ZAPPY ZANY Abundant Accomplished Achieving Active Admirable Adorable Adventurous Admired Affluent Agreeable Alert Aligned Alive Amazing Appealing Appreciate Artistic Astounding Astute Attentive Attractive Auspicious Authentic Awake Aware Beaming Beautiful Best Blessed Bliss Bold Bright Brilliant Brisk Buoyant Calm Capable Centered Certain Charming Cheerful Clear Clever Competent Complete Confident Connected Conscious Considerate Convenient Courageous Creative Daring Dazzling Delicious Delightful Desirable Determined Diligent Discerning Discover Dynamic Eager Easy Efficient Effortless Elegant Eloquent Energetic Endless Enhancing Engaging Enormous Enterprising Enthusiastic Enticing Excellent Exceptional Exciting Experienced Exquisite Fabulous Fair Far-Sighted Fascinating Fine Flattering Flourishing Fortunate Free Friendly Fulfilled Fun Generous Genuine Gifted Glorious Glowing Good Good-Looking Gorgeous Graceful Gracious Grand Great Handsome Happy Hardy Harmonious Healed Healthy Helpful Honest Humorous Ideal Imaginative Impressive Industrious Ingenious Innovative Inspired Intelligent Interested Interesting Intuitive Inventive Invincible Inviting Irresistible Joyous Judicious Keen Kind Knowing Limitless Lively Loving Lucky Luminous Magical Magnificent Marvelous Masterful Mighty Miraculous Motivated Natural Neat Nice Nurturing Noble Optimistic Outstanding Passionate Peaceful Perfect Persevering Persistent Playful Pleasing Plentiful Positive Powerful Precious Prepared Productive Profound Prompt Prosperous Proud Qualified Quick Radiant Reasonable Refined Refreshing Relaxing Reliable Remarkable Resolute Resourceful Respected Rewarding Robust Safe Satisfied Secure Seductive Self-Reliant Sensational Sensible Sensitive Serene Sharing Skillful Smart Smashing Smooth Sparkling Spiritual Splendid Strong Stunning Successful Superb Swift Talented Tenacious Terrific Thankful Thrilling Thriving Timely Trusting Truthful Ultimate Unique Valiant Valuable Versatile Vibrant Victorious Vigorous Vivacious Vivid Warm Wealthy Well Whole Wise Wonderful Worthy Young Youthful Zeal Zest """ unpleasant = """ANGRY DEPRESSED CONFUSED HELPLESS irritated lousy upset incapable enraged disappointed doubtful alone hostile discouraged uncertain paralyzed insulting ashamed indecisive fatigued sore powerless perplexed useless annoyed diminished embarrassed inferior upset guilty hesitant vulnerable hateful dissatisfied shy empty unpleasant miserable stupefied forced offensive detestable disillusioned hesitant bitter repugnant unbelieving despair aggressive despicable skeptical frustrated resentful disgusting distrustful distressed inflamed abominable misgiving woeful provoked terrible lost pathetic incensed in despair unsure tragic infuriated sulky uneasy in a stew cross bad pessimistic dominated worked up a sense of loss tense boiling fuming indignant INDIFFERENT AFRAID HURT SAD insensitive fearful crushed tearful dull terrified tormented sorrowful nonchalant suspicious deprived pained neutral anxious pained grief reserved alarmed tortured anguish weary panic dejected desolate bored nervous rejected desperate preoccupied scared injured pessimistic cold worried offended unhappy disinterested frightened afflicted lonely lifeless timid aching grieved shaky victimized mournful restless heartbroken dismayed doubtful agonized threatened appalled cowardly humiliated quaking wronged menaced alienated wary abysmal adverse alarming angry annoy anxious apathy appalling atrocious awful bad banal barbed belligerent bemoan beneath boring broken callous can't clumsy coarse cold cold hearted collapse confused contradictory contrary corrosive corrupt crazy creepy criminal cruel cry cutting dead decaying damage damaging dastardly deplorable depressed deprived deformed D Cont. deny despicable detrimental dirty disease disgusting disheveled dishonest dishonorable dismal distress don't dreadful dreary enraged eroding evil fail faulty fear feeble fight filthy foul frighten frightful gawky ghastly grave greed grim grimace gross grotesque gruesome guilty H haggard hard hard hearted harmful hate hideous homely horrendous horrible hostile hurt hurtful icky ignore ignorant ill immature imperfect impossible inane inelegant infernal injure injurious insane insidious insipid jealous junky lose lousy lumpy malicious mean menacing messy misshapen missing misunderstood moan moldy monstrous naive nasty naughty negate negative never no nobody nondescript nonsense not noxious objectionable odious offensive old oppressive pain perturb pessimistic petty plain poisonous poor prejudice questionable quirky quit reject renege repellant reptilian repulsive repugnant revenge revolting rocky rotten rude ruthless sad savage scare scary scream severe shoddy shocking sick sickening sinister slimy smelly sobbing sorry spiteful sticky stinky stormy stressful stuck stupid substandard suspect suspicious tense terrible terrifying threatening ugly undermine unfair unfavorable unhappy unhealthy unjust unlucky unpleasant upset unsatisfactory unsightly untoward unwanted unwelcome unwholesome unwieldy unwise upset vice vicious vile villainous vindictive wary weary wicked woeful worthless wound yell yucky zero """ import random pleasantWords = [] unpleasantWords = [] def initLists(): global pleasantWords global unpleasantWords # generate a list of pleasant words for word in pleasant.split( ): word = word.lower().strip() if len( word )==0: continue pleasantWords.append( word ) # generate a list of unpleasant words for word in unpleasant.split( ): word = word.lower().strip() if len( word )==0: continue unpleasantWords.append( word ) # remove duplicates pleasantWords = list(set( pleasantWords ) ) unpleasantWords = list( set( unpleasantWords ) ) # make the two lists equal size while len( pleasantWords ) > len( unpleasantWords ): pleasantWords = pleasantWords[0:-1] while len( unpleasantWords ) > len( pleasantWords ): unpleasantWords = unpleasantWords[0:-1] def main(): initLists() print( "\n\nLIST OF PLEASANT WORDS" ) print( pleasantWords ) print( "\n\nLIST OF UNPLEASANT WORDS" ) print( unpleasantWords ) if __name__=="__main__": main()