Compute the cartesian products

Assignment Help Other Subject
Reference no: EM132379446

Assignment -

Directions - Name your scripts 253-yourlastname-?-?.py. For example, my submission for P3 problem 4 would be a file 253-pauli-3-4.py.

(1) (PT) Read and work through the examples in

§3.1.3: Lists

§5.1.3: List Comprehensions

§5.4.: Sets

(2) (NP) Read and work through the examples in

  • Lists

(3) Write a script that contains the following. For each part, first print the number to make it easier to grade.

(a) A function is_subset(A,B) that for two sets A and B returns True if A ⊆ B and False otherwise. Use a for loop and in but not the build-in <=.

(b) A function is_proper_subset(A,B) that for two sets A and B returns True if A ⊂ B and False otherwise. Use a for loop and in but not the build-in <.

(c) Verification whether your functions work correctly by using them to determine whether the following are true or false. Use set comprehensions to construct sets given in set builder notation.

(i) ∅ ⊂ ∅

(ii) ∅ ⊆ ∅

(iii) {1, 2, 3} ⊆ ∅

(iv) ∅ ⊆ {1, 2, 3}

(v) {1, 2, 3} ⊆ {1, 2, 3}

(vi) {1, 2, 3} ⊂ {1, 2, 3}

(vii) {1, 4} ⊆ {x2|x ∈ {1, 2, 3, . . . , 20}}

(viii) {4, 10} ⊆ {x| x ∈ {1, 2, 3, . . . , 50} Λ x mod 3 = 1}

(ix) {x2|x ∈ {1, 2, 3, . . . , 50} Λ x mod 3 = 0} ⊂ {3, 81}

(4) Write a script that contains the following. For each part, first print the number to make it easier to grade.

(a) A function cartesian_product(A, B) that returns the cartesian product of two sets A and B. You can represent the tuple (a, b) either as a tuple or a list with two elements.

(b) Verification whether your functions works correctly by using them to compute the following cartesian products:

(i) {1, 2, 3} x {5, 6}

(ii) {1, 2} x {2}

(iii) {7} x {1, 2, 3, 4}

(iv) ∅ x {1, 2, 3, 4}

(v) {1, 2, 3, . . . , 40} x {1, 2}

Attachment:- Assignment File.rar

Reference no: EM132379446

Questions Cloud

Compute the companys current income tax expense or benefit : Woodward Corporation reported pretax book income of $1,000,000. Included in the computation were favorable temporary differences of $200,000.
Demonstrate logical and creative thinking in the analysis : Demonstrate logical and creative thinking in the analysis and application of a theory to nursing practice. Examine broad theoretical concepts as foundational.
What is the present value of an ordinary annuity consisting : What is the present value of an ordinary annuity consisting of 10 annual payments of $100 with an interest rate of 9% per annum.
Compute the future value in year 9 of deposit in year one : Compute the future Value in year 9 of a $3900 deposit in year one and another $3400 deposit at the end of year 5 using a 9% interest rate.
Compute the cartesian products : Verification whether your functions works correctly by using them to compute the following cartesian products: {1, 2, 3} x {5, 6}
What is the estimated cost for a patient whose surgery has : Recent research into the cost of various medical procedures has shown the impact of certain complications encountered in surgery on the total cost.
What impact might your solution have on the other levels : Many of you have experience in complex adaptive systems whether you realize it or not. Thinking about your current or future practice area, identify an issue.
What was the biggest obstacle you encountered : What worked best for this online course? What was the biggest obstacle you encountered? What suggestion would you have for improving the course layout?
Calculate the pooled variance : Calculate the power and n required using a single gene calculation for illustration of the formula and Calculate the pooled variance

Reviews

len2379446

9/30/2019 11:13:30 PM

Each project script should be uploaded to Canvas. Rubric - 10–9 pts: Script runs without errors. All required components are correctly addressed. The difference between 9 and 10 comes from coding style (comments, structure) and writing style (grammar and spelling in responses). 8–6 pts: Script runs without errors but some required component is missing or incorrect. The score in this range depends on the what is missed. 5 pts: Script does not run because of errors. 0 pts: No submission.

Write a Review

Other Subject Questions & Answers

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd