ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 02 Jun 2017 My Price 9.00

COMP 1005/1405A (Summer 2016)

hey i need help with my comp 1405 assignment, it is due june 6th, and here is the question if the attached file doesn't open. *please note that the code must be written in python*

 

 

 

Question 1 – Pascal's Triangle 50 Marks For this question you will write a program that will use loops to print out rows of Pascal's triangle while looking fora specific integer value provided by the user. (Pascal's triangle is a triangular table of coefficients for the expandedbinomial formula.)11 11 2 11 3 3 11 4 6 4 1The formula for getting the kth number(when you start counting at 0) in the nth row is????!????!(????−????)!.This calculation is known as the combination.The exclamation point (!) in that formula is used to indicate a factorial; the factorial of any number x is the productof all the integers from 1 up to an including x. As a clarifying example, since 2! = 1 * 2 = 2 and 4! = 1 * 2 * 3 * 4 = 24,the 2nd number (when you start counting at 0) of the 4th row is 4!  (2! (4-2)!) = 24 / (2(2)) = 6.You must write a factorial function and a combination function yourself and your combination function must callyour factorial function. You may not use global variables and programs that import the math library or userecursion will not be accepted and will receive a mark of zero. (10 Marks each)Your program will begin by asking the user for an integer value to look for in the triangle – you can safely assumethat the user will enter a number but if the user enters a floating-point number your program must print an errormessage and loop back to allow the user to try and enter another number (10 Marks). On the other hand, if the usergives a valid integer (e.g., 6) then your program will start printing complete rows of the triangle until it encounters a6 – once it encounters a 6, your program should complete the row and then terminate (10 Marks).Your program must center the triangle (as much as possible, as depicted above) in a console that is 60 charactersacross (5 Marks) and is expected to use the most appropriate type of looping control structure (pre-tested while,post-tested while, or for) for each subproblem (5 Marks).Question 2 – Basic Statistics 50 MarksFor this question you will write a program to receive nonnegative integers from a user before computing the mean,the trimmed mean (i.e., remove the smallest and largest values before calculating the mean), and the median.You must write all your functions and save them in an a5functions.py file and import them into your main programfile a5q2.py using the import statement. No funtions are to be in the main program file, a grade of 0 will be given ifany processing is done in the main program file. In effect, the main program file is limited to collecting input datafrom the user, calling the appropriate functions (in the a5functions.py file) and outputing information to the user.The main function should call a function (e.g. collectData()) that starts with an empty list and uses a while loop toask the user for the next value. As long as the value entered is nonnegative, your program should add the value as anew element to a list and then loop and ask the user for the next value, but if the value entered is negative yourfunction must stop, return the list back to the main program and run the statistics (10 marks).Each of the three statistic functions must receive the list (and only the list) as an argument and return a singlefloating-point value for the resulting statistic (10 marks each). If you are not familiar with these statistics you willneed to research them independently - a function that computes a statistic incorrectly will be heavily penalized. Abrief overview of each of the three statistics is provided below.The program is expected to output properly formatted statements indicating the list values, the correspondingcalculation type and calculated value (10 marks)The mean is the sum over all the values in the list divided by the number of values in the list. Even if the list elementsare all integers, the resulting mean could still be a real number.The trimmed mean is the mean value if the largest and smallest values in the list are not considered. As a clarifyingexample: the trimmed mean of [1, 2, 3, 4, 99] is 3 (i.e., (2+3+4)/3)The median is the "middle" value in the list if the list is in sorted order. You may use the built-in Python "sort()"method to accomplish this (http://www.tutorialspoint.com/python/list_sort.htm). Please note that when thenumber of elements in the list is odd, the median value is the middle element of the sorted list, but if the number ofelements in the list is even, the median is the sum of the two middle elements of the sorted list, divided by 2. As aclarifying example: the median of [2, 3, 5, 4, 1] would be 3, because the middle element of [1, 2, 3, 4, 5] is 3 the median of [6, 5, 3, 4, 1, 2] would be 3.5, because the middle elements are 3 and 4 and (3+4)/2 = 3.5

 

COMP 1005/1405A (Summer 2016)Assignment 5 of 6Due: Tues, June 7thby 11:55pmFor each question in this assignmentyou will be submitting three files containing source code written in Python 3,that have been compressed into a "zip" file.ThePython sources(i.e., the .py files)should be named "a5q1.py" and"a5q2.py". Thezip file should be named a5.zip. You willsubmit your file using cuLearn.NO LATE ASSIGNMENTS WILL BE ACCEPTEDYou are expected todemonstrate good programming practices at all times(e.g., choosing descriptive variablenames, provide comments in your code, etc.) andyour code may be penalized if it is poorly written. You are alsoexpected todo the necessary preparatory work(i.e., devising an algorithm)before you start coding.PLEASE NOTE: YOU WILL BE ASKED TO PRESENT EITHER PSEUDOCODE OR A FLOWCHART BEFORE YOU WILLRECEIVE ANY ASSISTANCE FROM THE INSTRUCTOR OR A TEACHING ASSISTANTYour program must compile before it will be graded - even if does not address all the items listed for the question.If your program does not compile you will receive a grade of 0 for that question. If you do not address all the itemslisted in the question then, 1) comment your code accordingly, indiciate what part(s) of the question were notaddressed in your assignment, and 2) print a notification to the console indicating the funtion or requirement thathas been omitted.Question 1 – Pascal's Triangle50 MarksFor this question you will write a program that will use loops to print out rows of Pascal's triangle while looking fora specific integer value provided by the user. (Pascal's triangle is a triangular table of coefficients for the expandedbinomial formula.)11 11 2 11 3 3 11 4 6 4 1The formula for getting the kthnumber(when you start counting at 0) in the nthrow is°!±!(°−±)!.This calculation is known as the combination.The exclamation point (!) in that formula is used to indicate a factorial; the factorial of any number x is the productof all the integers from 1 up to an including x. As a clarifying example, since 2! = 1 * 2 = 2 and 4! = 1 * 2 * 3 * 4 = 24,the 2ndnumber (when you start counting at 0) of the 4throw is 4!(2! (4-2)!) = 24 / (2(2)) = 6.You must write a factorial function and a combination functionyourselfand your combination function must callyour factorial function.You may not use global variables and programs that import the math library or userecursion will not be accepted and will receive a mark of zero.(10 Marks each)Your program will begin by asking the user for an integer value to look for in the triangle – you can safely assumethat the user will enter a number but if the user enters a floating-point number your program must print an errormessage and loop back to allow the user to try and enter another number (10 Marks). On the other hand, if the usergives a valid integer (e.g., 6) then your program will start printing complete rows of the triangle until it encounters a6 – once it encounters a 6, your program shouldcomplete the row and then terminate (10 Marks).

Answers

(11)
Status NEW Posted 02 Jun 2017 12:06 AM My Price 9.00

-----------

Not Rated(0)