Question: USING PYTHON PROGRAMMING LANGUAGE 3. A pyramidal number is a number that is the sum of the first n consecutive square integers. So, the first
USING PYTHON PROGRAMMING LANGUAGE
3. A pyramidal number is a number that is the sum of the first n consecutive square integers. So, the first pyramidal number is 1 (since 121); the second pyramidal number is 5 (since 1225); the third pyramidal number is 14 (since 12 22 32 14); and so on Write a program that allows the user to input an integer n, and the prints out the first n pyramidal numbers. For example, if the user enters 3, the program would print out the first 3 pyramidal numbers: 1, 5, and 14, each on a different line For full credit, write and use a function called pyr whose input is an integer x, and whose output is the xth pyramidal number. For example, the value of pyr (3) should be 14 Your program and function only need to work if the inputs are positive integers 4. Write a program that asks the user to enter integer values n and k, and then computes n choose k (you may have seen k) which is given by the foraTF 5!120 For example, 5C2 = 2131-2.6 this written as C or For full credit, use a function as part of your program - you probably want to write the factorial operation as a function; otherwise, you will need several loops, instead of just one! Your program only needs to work if the entered n and k values are 0 or positive
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
