Concept explainers
Using python IDLE and write code using repetition to create the following patterns
999999999888888887777777666666555554444333221
Note; create means you must create with program code, not just assign it as a literal.
The problem
Write a program that asks the user for an integer between 1 and 25 and then generates the pattern that many
times.
Here are two sample runs:
How many rows? 5
999999999888888887777777666666555554444333221
999999999888888887777777666666555554444333221
999999999888888887777777666666555554444333221
999999999888888887777777666666555554444333221
999999999888888887777777666666555554444333221
How many rows? 30
Out of range - must be between 1 and 25
How many rows? 0
Out of range - must be between 1 and 25
How many rows? 2
999999999888888887777777666666555554444333221
999999999888888887777777666666555554444333221
Advice: there are two issues to deal with for this program – getting the number and printing out the pattern that
many times. A systematic approach is to
1. get your program working to print the pattern once, (a loop)
2. expand your program to print it multiple times, (nested loop_)
3. Expand to include the request for the number of times.
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 4 images
- Using python, please explain 1: A positive integer greater than 1 is said to be prime if it has no divisors other than 1 and itself. A positive integer greater than 1 is composite if it is not prime. Write a program that asks the user to enter an integer greater than 1, then displays all of the prime numbers that are less than or equal to the number entered The program should work as follows: Once the user has entered a number, the program should populate a list with all of the integers from 2 up through the value entered. The program should then use a loop to step through the list. The loop should pass each element to a function that displays the element whether it is a prime number.arrow_forwardIn PYTHON Using one of the loop construct draw:- Ten dashed Horizontal lines- Each line of length 150 units (or pixels)- All lines aligned at the same left vertical margin- Lines 10 units apart each other Note- Set the length of solid segment to 10 units- Set the length of the non-visible segment to 5 units Assumption- Use of Turtle library (i will check the answer, it has to be correct)arrow_forwardPYTHON CODE Write a program that will ask a user to input a word and that will check if the word is a palindrome. A palindrome is a word that when spelled backwards is the same when read forwardsarrow_forward
- code in matlabarrow_forwardExample Execution Trace You must exactly match the below layout. Melcome to a fun word replacement game Enter the name of the file to use: examplel.txt Please give a name Mark Please give a place Drexe ї Please give a day of the week Friday Please give a time Please give a verb eat Please give an animal Please give a body part mouth Here is your story: Mark is having a party! It's going to be at Drexel on Friday. Please make sure to show up at noon, or else you will be required to eat a/an raccoon with your moutharrow_forwardGiven a positive integer n, the following rules will always create a sequence that ends with 1, called the hailstone sequence: If n is even, divide it by 2 If n is odd, multiply it by 3 and add 1 (i.e. 3n +1) Continue until n is 1 Write a program that reads an integer as input and prints the hailstone sequence starting with the integer entered. Format the output so that ten integers, each separated by a tab character (\t), are printed per line. The output format can be achieved as follows:System.out.print(n + "\t"); Ex: If the input is: 25 the output is: 25 76 38 19 58 29 88 44 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 (NEED HELP IN JAVA PLEASE)arrow_forward
- Java use While loop: Write a program that creates two random numbers, ask user to finde the sum of them, takes the user input, check if it true, if so print " You got it ", if not prints " try again ".arrow_forwardDesign an algorithm for a problem that processes results of a swimming competition. The program will set a number of competitors, obtain their names from the user, and uses random number generator to get the results (in seconds, as real numbers with three digits after the decimal point). Then it will find and display the average timefor all competitors, andthe names and best three results (first, second, and third places). 1. Set a number of competitors as a constant TOTAL (no more than 10) 2. Declare two arrays to hold names and results (an actual array should have different name than the formal array in the function definitions) 3. Call functions to fill the arrays with names (user entries) and results (random decimal numbers) 4. Print all names and results as a table with appropriate titles 5. Display the average time (by calling function getAverage()) 6. Sort the array of results and corresponding names 7. Print names and results for the first three places (first…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education