FUNCTION 1. Write a function that takes a number and a character (as parameters) and prints...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
FUNCTION 1. Write a function that takes a number and a character (as parameters) and prints a triangle of that size using the specified character. 2. Write a function that takes the radius of a sphere as a parameter and returns its volume. 3. Write a function that takes a numberas parameter and returns the factorial. 4. Write a function that takes an integer as parameter and returns thenumber of digits. 5. Write a function that takes an integer as parameter and returns thesum of digits 6. Write a function that takesan integer as parameter and returns thereverse number. 7. Write a function that takes two numbersas parameters and returns their HCF. 8. Write a function that takes two numbersas parameters and returns their LCM. 9. Write a function that checks if a number isprime or not. If the number is prime the function returns true, otherwise false. Also try functions for checking perfect numbers and pallindromes. 10. Write a function that sorts an array of numbers. In the main function, first create and print the unsorted array, then use the function to sort the array, then print the sorted array. 11. Write a function that returns the minimum, maximum and the average value of an arraypassed as a parameter. 12. Write a function that takes a string as parameter and returns the number of words in that string. 13. Write a function that takes a string as a parameter, changes all the letters to uppercase letters and returns the updated string. 14. Write a function that takes an IUB student ID as a string parameter, then checks if the ID is valid. F the ID is valid the function returns true, otherwise it returns false. 15. Write a function that returns the answer to life the universe and everything. 1. Create a 5 x 3 integer array. Fill it with random numbers between 30 and 50. Print the array. 2. Create two 4 by 3 integer matrices called A and B. Subtract A from B and store the resultant matrix in C. Print A, B and C matrices. 3. Take the size of a matrix, A, from the user. Create the matrix, A, and fill it with user input. Then store the transpose of Ain another matrix B. Print both A and B. 4. Create a 4 by 3 integer matrices called A and a 3 by 2 integer matrix called B. Fill both matrices with random numbers. Multiply A and B and store the resultant matrix in C. Print A, B and C. 5. Count the number of prime numbers in a 2D integer array. 6. Compute the average value of each of the rows of a 15 x 10 floating point array. 7. Convert a 5x7 (2D) integer array to a 1Darray. 8. Convert a 1D array of size 10 to a 2x5 or 5 x 2 (2D) array (make sure no data is lost). 9. Create a 5 x 5 matrix. Compute the sum of the values along the two diagonals. Print the sums separately. 10. Create an 8 x 8 chessboard pattern using the extended ASCII codes. 11. Challenge problem: Create a 7 x 7 magic square using a 2D array. Magic square is a square where the sum of every row and column and diagonal is the same. For example, a 3 x 3 magic square looks like: 276-15 951-15 4 38 15 Y 15 15 15 15 15 12. Challenge problem: Write a Tic-Tac-Toe game where the computer never loses. FUNCTION 1. Write a function that takes a number and a character (as parameters) and prints a triangle of that size using the specified character. 2. Write a function that takes the radius of a sphere as a parameter and returns its volume. 3. Write a function that takes a numberas parameter and returns the factorial. 4. Write a function that takes an integer as parameter and returns thenumber of digits. 5. Write a function that takes an integer as parameter and returns thesum of digits 6. Write a function that takesan integer as parameter and returns thereverse number. 7. Write a function that takes two numbersas parameters and returns their HCF. 8. Write a function that takes two numbersas parameters and returns their LCM. 9. Write a function that checks if a number isprime or not. If the number is prime the function returns true, otherwise false. Also try functions for checking perfect numbers and pallindromes. 10. Write a function that sorts an array of numbers. In the main function, first create and print the unsorted array, then use the function to sort the array, then print the sorted array. 11. Write a function that returns the minimum, maximum and the average value of an arraypassed as a parameter. 12. Write a function that takes a string as parameter and returns the number of words in that string. 13. Write a function that takes a string as a parameter, changes all the letters to uppercase letters and returns the updated string. 14. Write a function that takes an IUB student ID as a string parameter, then checks if the ID is valid. F the ID is valid the function returns true, otherwise it returns false. 15. Write a function that returns the answer to life the universe and everything. 1. Create a 5 x 3 integer array. Fill it with random numbers between 30 and 50. Print the array. 2. Create two 4 by 3 integer matrices called A and B. Subtract A from B and store the resultant matrix in C. Print A, B and C matrices. 3. Take the size of a matrix, A, from the user. Create the matrix, A, and fill it with user input. Then store the transpose of Ain another matrix B. Print both A and B. 4. Create a 4 by 3 integer matrices called A and a 3 by 2 integer matrix called B. Fill both matrices with random numbers. Multiply A and B and store the resultant matrix in C. Print A, B and C. 5. Count the number of prime numbers in a 2D integer array. 6. Compute the average value of each of the rows of a 15 x 10 floating point array. 7. Convert a 5x7 (2D) integer array to a 1Darray. 8. Convert a 1D array of size 10 to a 2x5 or 5 x 2 (2D) array (make sure no data is lost). 9. Create a 5 x 5 matrix. Compute the sum of the values along the two diagonals. Print the sums separately. 10. Create an 8 x 8 chessboard pattern using the extended ASCII codes. 11. Challenge problem: Create a 7 x 7 magic square using a 2D array. Magic square is a square where the sum of every row and column and diagonal is the same. For example, a 3 x 3 magic square looks like: 276-15 951-15 4 38 15 Y 15 15 15 15 15 12. Challenge problem: Write a Tic-Tac-Toe game where the computer never loses.
Expert Answer:
Answer rating: 100% (QA)
1 Heres a Python function that takes a number and a character as parameters and prints a triangle of that size using the specified character python def printtrianglesize char for i in range1 size 1 pr... View the full answer
Related Book For
Microeconomics An Intuitive Approach with Calculus
ISBN: 978-0538453257
1st edition
Authors: Thomas Nechyba
Posted Date:
Students also viewed these programming questions
-
7.2.6 A financial institution has taken over the business of another company. One of the acquired liabilities is a capital redemption policy that obligates the payment of 1,000,000 by the institution...
-
1. Write a script that generates two random numbers between 1 and 10 and if the numbers match then prints Match Found else prints Different Numbers. You can use $RANDOM to generate the random...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
You are to show the journal entries necessary to record the following items which occured in 2012: (a) May 1 Bought a van on credit from Deedon Garage for 6,000. (b) May 3 A debt of 100 owing from P....
-
For the situation shown in Figure P31.32, the magnetic field changes with time according to the expression B = (2.00t 3 - 4.00t 2 + 0.800)T, and r2 = 2R = 5.00 cm. (a) Calculate the magnitude and...
-
Ammonia gas is compressed from 21oC and 200 kPa to 1000 kPa in an adiabatic compressor with an efficiency of 0.82. Estimate the final temperature, the work required, and the entropy change of the...
-
Following is a performance report for Electric Hero. Required (a) Calculate the variances, stating whether they are favourable or unfavourable, and suggest possible reasons for variances that you...
-
Happy Camper Park was organized on April 1, 2009, by Amaya Berge. Amaya is a good manager but a poor accountant. From the trial balance prepared by a part-time bookkeeper, Amaya prepared the...
-
Emboldened by the growing online presence of their fellow white supremacists, the organizers of the 2017 Unite the Right rally expanded their activities this year. This year's rally spanned 10 days...
-
Aggie Oil Corporation, a new successful efforts company, incurred the following costs and made the other transactions shown below for the years 2018 and 2019. 2018 a. Paid $225,000 for G&G costs...
-
Predict the expected product of the following reaction. CH3 H3C CH' CI EtO CH3
-
The following table shows statistics on 10 Feb 2021 for firms in the Material sector in Australia. Calculate the share price of Rio Tinto using relative valuation approach. If you exclude any of the...
-
In December 2019, a novel coronavirus outbreak was first documented in Wuhan, China. This virus triggered crisis for the global economy and markets including Ghana. With an escalating number of...
-
Pizza Vesuvio makes specialty pizzas. Data for the past 8 months were collected: Month Labor Cost Employee Hours January $7,000 360 February 8,140 550 March 9,899 630 April 9,787 610 May 8,490 480...
-
A spring with a 4 kg mass has natural length 1 m and is stretched to a length of 170 cm by a force of 24.3 N. If the spring is compressed to a length of 0.5 m and then released with zero velocity,...
-
To calculate the Expected Rate of Return for USR (US Rubber): Economy Prob. T-Bills. HT Recession 0.1 3.0% -29.5% Coll USR MP 24.5% 3.5% -19.5% 0.2 3.0% -9.5% 10.5% -16.5% -5.5% Below avg Average 0.4...
-
A drug is administered using intravenous infusion (IV). Assuming it can be modeled by a one compartment model for the amount r(t) in the plasma with elimination rate is k > 0. The drug input is given...
-
Write a paper by answer the following question: Should Recycling Be Mandatory?
-
Under perfect competition, we found that the economic incidence of a taxi.e. who ends up paying a taxhad nothing to do with statutory incidencei.e. who the law said should pay the tax. A: Suppose the...
-
A: Assume that the production technology uses labor and capital k as inputs, and assume through- out this problem that the firm is currently long run profit maximizing and employing a production...
-
Children, Parents, Baby Booms and Baby Busts: Economists often think of parents and children trading with one another across time. When children are young, parents take care of children; but when...
-
Understanding the Feds actions that are needed to stabilize the interest rate The diagram below shows three different money demand curves and a target interest rate i*. Fill in the table below using...
-
This section looks at US recessions over the past 60 years. To work out this problem, first obtain quarterly data on US output growth for the period 1960 to the most recent data from www.bea.gov....
-
This question asks you to examine the movements of investment and consumption before, during and after the recession of 2001. It also asks you to consider the response of investment and consumption...
Study smarter with the SolutionInn App