Closed

PYTHON HOMEWORK!!!

CLICK HERE [url removed, login to view]

SLP assignment: your assignment is about classes & methods, inheritance,input/output, linked lists, and improve the program questor.

Require

Read chapter 17 and 18 from “Think Python: How to Think Like a Computer Scientist (Version 1.3.3)”, a reference in the background materials. Code all the examples and exercises except 17.12 & 18.11 in Python and successfully run them.

Read chapter 12 from A Byte of Python, a reference in the background materials. Code all the examples and exercises in Python IDE and successfully run them.

Read chapter 17 from “How to Think Like a Computer Scientist Learning with Python (1st Edition)”, a reference in the background materials. Code all the examples in Python and successfully run them.

Find a way to improve the program below to save the input data and load it back in so that the program doesn't get amnesia every time you quit. Run and debug your improved program.

This is a Python program which has a class and other features. In this script, you think of an item, and the computer tries to guess it. When it is wrong, you teach it about your new item. After a few dozen games, it starts to get pretty smart!

# [url removed, login to view]

# define some constants for future use

kQuestion = 'question'

kGuess = 'guess'

# define a function for asking yes/no questions

def yesno(prompt):

ans = raw_input(prompt)

return (ans[0]=='y' or ans[0]=='Y')

# define a node in the question tree (either question or guess)

class Qnode:

# initialization method

def __init__(self,guess):

[url removed, login to view] = kGuess

[url removed, login to view] = guess

# get the question to ask

def query(self):

if ([url removed, login to view] == kQuestion):

return [url removed, login to view] + " "

elif ([url removed, login to view] == kGuess):

return "Is it a " + [url removed, login to view] + "? "

else:

return "Error: invalid node type!"

# return new node, given a boolean response

def nextnode(self,answer):

return [url removed, login to view][answer]

# turn a guess node into a question node and add new item

# give a question, the new item, and the answer for that item

def makeQuest( self, question, newitem, newanswer ):

# create new nodes for the new answer and old answer

newAnsNode = Qnode(newitem)

oldAnsNode = Qnode([url removed, login to view])

# turn this node into a question node

[url removed, login to view] = kQuestion

[url removed, login to view] = question

# assign the yes and no nodes appropriately

[url removed, login to view] = {newanswer:newAnsNode, not newanswer:oldAnsNode}

def traverse(fromNode):

# ask the question

yes = yesno( [url removed, login to view]() )

# if this is a guess node, then did we get it right?

if ([url removed, login to view] == kGuess):

if (yes):

print "I'm a genius!!!"

return

# if we didn't get it right, return the node

return fromNode

# if it's a question node, then ask another question

return traverse( [url removed, login to view](yes) )

def run():

# start with a single guess node

topNode = Qnode('python')

done = 0

while not done:

# ask questions till we get to the end

result = traverse( topNode )

# if result is a node, we need to add a question

if (result):

item = raw_input("OK, what were you thinking of? ")

print "Enter a question that distinguishes a",

print item, "from a", [url removed, login to view] + ":"

q = raw_input()

ans = yesno("What is the answer for " + item + "? ")

[url removed, login to view]( q, item, ans )

print "Got it."

# repeat until done

print

done = not yesno("Do another? ")

print

# immediate-mode commands, for drag-and-drop or execfile() execution

if __name__ == '__main__':

run()

print

raw_input("press Return>")

else:

print "Module questor imported."

print "To run, type: [url removed, login to view]()"

print "To reload after changes to the source, type: reload(questor)"

# end of [url removed, login to view]

Add the Python files from all 3 requirements above to one zip file. Add a one page write-up of your results and experiences to the zip file.

SLP assignment expectations:

Implement the code required for all the above 3 requirements.

Write a one page description of your results and experiences.

Skills: Python

See more: questor python save reload, what is a tree node, tries tree, tree query, smart input, scientist ask questions, python learning, python get type, python find, node of a tree, node in tree, learning to write code, learning computer code, how to read computer code, how to quit, how to find a scientist, find python, do your homework for you, do homework for you, ask a question answer a question, what is node, python end, write a python script, think debug, python: get data

About the Employer:
( 0 reviews ) Birmingham, United States

Project ID: #4468718

19 freelancers are bidding on average $107 for this job

tlyx

The link you provided is useless because you didn't give us login credentials.

$231 USD in 5 days
(22 Reviews)
4.6
RhynoProgramming

I'm an advanced Python programmer with over 2 years of programming experience. This project will be simple and I can have it to you quickly.

$66 USD in 3 days
(6 Reviews)
4.5
rajeeshnairvw

Started Python life 8 years before with "How to think Like a Computer Scientist: Learning in Python" version 1. Can do finish it at the earliest.

$64 USD in 2 days
(2 Reviews)
1.9
bdlancer09

I can do the assignment for you.

$82 USD in 2 days
(1 Review)
1.4
expertc0ding

Expert Solution here. Check PM

$189 USD in 3 days
(2 Reviews)
0.0
enkidulan

Hello, I have 3 years python programming experience and it will be my pleasure to help you with this task :)

$55 USD in 4 days
(0 Reviews)
0.0
nganpho

I have 2 years to teach data struct and 2 years for program python, so i can help you with a few minute. You can online and skype me at: dinhnhonam

$77 USD in 3 days
(0 Reviews)
0.0
stefanczarnecki

3+ years of experience in Python

$50 USD in 3 days
(0 Reviews)
0.0
Jraml

I am a computer scientist graduated. I teach programming languages, specially object oriented programming languages, so I have years of experience in Python.

$100 USD in 3 days
(0 Reviews)
0.0
tinggao

Hi, I did a very similar assignment before, please contact me if interested.

$55 USD in 3 days
(0 Reviews)
0.0
pedjaa

I can do that assignment

$165 USD in 3 days
(0 Reviews)
0.0
norakhafaga

It is very easy to do as it just the basic concepts of python,I can and ready to do it

$66 USD in 5 days
(0 Reviews)
0.0
rsonbol

I can do it

$147 USD in 3 days
(0 Reviews)
2.2
NotABug

Greetings, I'll finish this task in less than a day after your approval. I have extensive experience with programming and scripting languages, specially with Python. I'll provide a clear and commented code, easy to un More

$100 USD in 1 day
(0 Reviews)
0.0
solomonhume

I have a grade point average of 4.0 for my Python courses. I am an expert python programmer.

$55 USD in 3 days
(0 Reviews)
0.0
Qiantangren

I could help you to complete this work! but I could not login in the given url for unauthenticated. you could connect me with email for detail. Hope you will have fun !

$154 USD in 3 days
(0 Reviews)
0.0
iu1nguoi

I have done this exact same project before. Check private message for detail.

$66 USD in 2 days
(0 Reviews)
0.0
JohaneCrash

This project is very easy to do. Let me help you with it

$154 USD in 3 days
(0 Reviews)
0.0
danielmartinspt

Hi sir, I'm a portuguese freelance software developer. Besides that I'm finishing my master degree in Computer Science. So, I can easily accomplish what you need in just a couple of hours. Please get in touch to dis More

$110 USD in 1 day
(0 Reviews)
0.0
DevDDevelopers

I am a Designer cum hardcore Python Web developer with over three years of professional experience in the fields related to Human-Computer-Interaction, as a designer cum developer who codes. My everyday work includes l More

$121 USD in 3 days
(0 Reviews)
0.0