跳至主要內容

Homework 3

AI悦创原创1v1python 1v1数据结构一对一留学生辅导留学生作业辅导northeastern一对一辅导东北大学Python辅导东北大学Python一对一辅导大约 2 分钟...约 746 字

Part 1: Book exercises

Create a text file called hw3_book_exercises.txt. Answer 4.14 Exercises questions 1-7 from the book.

Part 2: Expert system

One of the earliest forms of artificial intelligence (AI) were expert systems. An expert system is a system designed to make decisions or arrive at diagnoses based on information it is given. The decisions it makes are based on a sequence of conditionals.

A fever diagnosis system

For this exercise, you will create an expert system to diagnose the cause of a fever. You will use the input function to interview a patient about their symptoms.

Look at the image below to see how the symptoms are associated with various possible causes. Your program should ask the pertinent questions and direct the diagnosis as indicated by the chart.

Note that there are many cases of nested conditionals and there are some cases where more than one condition can lead to the same diagnosis. Try to write your program to be as concise as possible, and avoid duplicating code as much as you can.

img
img

Image/exercise from Java: Programming Design by James Cohoon and Jack Davidson

Functions

Portions of this exercise may help to further understand the motivation to define functions. Are there places where you would be forced to type the same code more than once? Use functions to minimize repeated code. Call the function in the place where the code needs to execute.

Submission

Submit the files hw3_book_exercises.txt. and expert_system.py to Canvas.

Style Guide

Please familiarize yourself with the PEP 8 Python Style guideLinks to an external site.open in new window. These are excellent tips for writing clear Python code and you should follow this style.

Before you submit your assignment, go through the checklist below and make sure your code conforms to the style guide.

  • No unused variables or commented-out code is left in the class
  • Your code is appropriately commented
  • All numbers have been replaced with constants (i.e. no "magic numbers").
  • Proper capitalization of any names used: snake_case for ordinary variables and functions, CapWords for class names, and ALL_CAPS for constants
  • Use white space to separate different sections of your code (follow the Pycodestyle linter's guidance)

Using the Pycodestyle linter

In addition to the checklist above, use the Pycodestyle linter in your editor to make sure you're catching small style issues of spacing and consistency. The graders will use the Pycodestyle linter as a guide for enforcing PEP8 style, which should simplify the process for them and you. It's easy to track down issues with the linter and you should make sure that the linter report is completely error and warning free before submitting.

公众号:AI悦创【二维码】

AI悦创·编程一对一

AI悦创·推出辅导班啦,包括「Python 语言辅导班、C++ 辅导班、java 辅导班、算法/数据结构辅导班、少儿编程、pygame 游戏开发、Web、Linux」,全部都是一对一教学:一对一辅导 + 一对一答疑 + 布置作业 + 项目实践等。当然,还有线下线上摄影课程、Photoshop、Premiere 一对一教学、QQ、微信在线,随时响应!微信:Jiabcdefh

C++ 信息奥赛题解,长期更新!长期招收一对一中小学信息奥赛集训,莆田、厦门地区有机会线下上门,其他地区线上。微信:Jiabcdefh

方法一:QQopen in new window

方法二:微信:Jiabcdefh

上次编辑于:
贡献者: AndersonHJB
你认为这篇文章怎么样?
  • 0
  • 0
  • 0
  • 0
  • 0
  • 0
评论
  • 按正序
  • 按倒序
  • 按热度