CWAN script in Python finished

Figured out to carry over my ruby project over to python2.7. I’ve been having some trouble with pip3 on Python3.8. So using Python2.7 at the moment:

This takes two word inputs, and infers a compound word:

# Imports duckduckgo, reads in input file, and assings it to duckduckgo query.
def first_input():
  import duckduckgo

  first_word = raw_input("What is your first word? >> ")
  ddg         = duckduckgo.query(first_word)

  print first_word
  print ddg.type
  print ddg.abstract.url
  print ddg.related[1].text
  
  print " "

  second_word = raw_input("What is your second word? >> ")
  ddg         = duckduckgo.query(second_word)

  print second_word
  print ddg.type
  print ddg.abstract.url
  print ddg.related[1].text
  
  print " "
  
  print("You're looking for " + first_word + second_word + ".")
  
  third_word = first_word + second_word
  ddg         = duckduckgo.query(third_word)
  
  print " "
  
  print third_word
  print ddg.type
  print ddg.abstract.url
  print ddg.related[1].text

# Initialize method
f = first_input()

The ruby version is further along, where I’ve figured out how to read input from files rather than a user string.