Python 作業輔導

Python程序輔導 輔導Python編程作業 Assignment

python 答疑

問:

Python 2.7.6 (default, Sep ?9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.
>>> s=”01234″
>>> s[0:1]
‘0’
>>>
字符串[:] 這種形式,也是左閉右開的區間嗎?
所以
range(x,y) = [x,y] 等于數學上的 [ x, y)
答:
一般而言,無論是在python里還是其它的編程語言,range一般都是左閉右開。
不局限地python中的s[x:y],range(x,y)
像c++ STL中的begin(),end()等都是這樣,end()-1才是最后一個元素。“
問:
python import copy中有 shallow copy 和 deep (recursive) copy
import copy

newobj = copy.copy(oldobj) # shallow copy
newobj = copy.deepcopy(oldobj) # deep (recursive) copy

對于dict={“string”:”string”, …} 這樣的dict
shallow copy和deep (recursive) copy的結果是相同的, 都cop

polish to BNF via recrusive

  1. Implement a recursive function?evalPolish(expression)?that shall evaluate (calculate) an expression written in the?. The expression shall be defined recursively in the??(BNF):

    1. expression ::= integer_or_floating_point_number #?A number is an expression; its value is the number itself
    2. expression ::= (operator, expression, expression) #?A 3-element tuple of an operator and another two expressions is also an expression; its value is the operator applied to the values of the expressions
    3. operator ::= “+” | “-” | “*” | “/” #?The list of supported operators; feel free to extend it

    <标题>Here is a sample expression and its evaluation:

    >>> good = ("+", ("-", 3, 1), ("*", ("/", 3, 4), 7)) # Same as

python questions

<标题>1.What is the value of the following expression:

sеt (rаngе (0, 20, 3)) & sеt (rangе (0, 20, 2))

{0, 6, 12, 18}

{0, 2, 3, 4, 6, 8, 9, 10, 12, 14, 15, 16, 18}

{3, 9, 15}

{2, 3, 4, 8, 9, 10, 14, 15, 16}

. 2.

Which operators are applicable to sets? (Check all that apply.)

+

*

&

|

^

/

in

. 3.

Which expression correctly changes the tail (the last element) of the middle item in the following

tuple:

foo=(12, [“a”, “n”, “d”, “y”], set (“andy”))

foo[1][-1] = “a”

<标题>foo[0][0] = “a”

Tuples are immutable and cannot be changed.

<标题>The tuple foo has items of different data types and is illegal.

. 4.

<标题>Which data type cannot be used as a key in a dictionary?

list

int

float

string

. 5.

<标题>Which data structures could be used instead of the following dictionary without any loss of

<标题>information and functionality, including possible modifications both of element names and their

weights?

elements = {“H” : 1, “He” : 4, “Li” : 7, “Be” : 9}

names = [“H”, “He”, “Li”, “Be”]

weights =

python csv assignment

  • <标题>Write a command-line program that reads a and reports some basic statistics of the data in the file.

    <标题>The program must have the comment at the top of the program file: “I certify this submission as my own original work completed in accordance with the Suffolk University Academic Integrity Policy. ZZZ”, where ZZZ is the full name of the student.

    The program shall ask the user to enter the name of a CSV file. If the file does not exist, the program shall print the error message: “File XXX does not exist.” where XXX is the file name, as entered by the user, and exit. Use the attached file grades.csv for testing.

    <标题>The program shall read the file contents. Assume that the file has a perfect rectangular structure: each uncommented row has the same number of columns, and each column has the same number of rows. A row that begins with a pound sign # is commented and shall be i

cs112 project5

<标题>python 程序代寫

Programming Project 5

<标题>This semester you will be writing a program that models elements of recognizing and creating characters. is an important area of research that allows photographs or printed documents to be digitized; by doing so, these documents are made available for machine-based searching. On the flip side, is a system for differentiating between humans and computers: the goal here is to generate a non-machine readable image that a human could identify. CAPTCHA helps reduce the amount of spam on the Internet.

We will implement a highly limited type of image matching, processing, and creation this semester. Rather than write this project at once, we will break the proj

cs112 project4

python作業代寫

Programming Project 4

This semester you will be writing a program that models elements of recognizing and creating characters. is an important area of research that allows photographs or printed documents to be digitized; by doing so, these documents are made available for machine-based searching. On the flip side, is a system for differentiating between humans and computers: the goal here is to generate a non-machine readable image that a human could identify. CAPTCHA helps reduce the amount of spam on the Internet.

We will implement a highly limited type of image matching, processing, and creation this semester. Rather than write this project at once, we will break the proje

python Three-card Poker

<标题>4.1 Overview

Gambling has a long (and sordid) history on the internet. The history of computer games, however, is

<标题>quite a bit older than the internet. For this program, you will develop and code a game ofthree-card

poker. The computer (the?Dealer) will play against a single human player (the?Player). Your program

<标题>should present the game as described below.

4.2 Rules of Three-card Poker

The Player starts with a?stake: some pre-determined amount of money ($100 in your program). A

game of Poker consists of a set of sub-games. Before beginning a sub-game, the Player must be able

<标题>to bet the?ante, a pre-determined amount of money ($10 in your program). In each sub-games, both

the?Player?and?Dealer?is dealt a?hand?of three cards. Each can see their own cards, but not the others.

After seeing the hand, the Player must determine whether he will?play?or?fold. If the Player folds, he

<标题>forfeits the?ante: his?stake?is reduced by the?ante?amount. If the Player elects to?play, then the Dealer

<标题>must either?play?or?

ECS10 WQ15 Project 5 solution

<标题>很好玩的python作業代寫,根據詞頻破解密鑰

ECS10 WQ15

February 28, 2015

<标题>Due March 13, 2015 at 11:55 PM

Project 5

<标题>You will be working alone for this project. This specification may change at any time for additional clarification. You should avoid using existing source code as a primer that is currently available on the Internet. You must specify in your comments of the file any sources of code that you have viewed to help you complete this project. All class projects will be submitted to MOSS to determine if students have excessively collaborated. Excessive collaboration, or failure to list external code sources will result in the matter being transferred to Student Judicial Affairs.

1. You will be writing a Python module to handle enc