Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Language: Python Software: Processing Question 1(5 points): Purpose: To practice using for loops, to practice using simple libraries Degree of Difficulty: Easy Words can be
Language: Python
Software: Processing
Question 1(5 points): Purpose: To practice using for loops, to practice using simple libraries Degree of Difficulty: Easy Words can be tricky to read when the letters are all jumbled up. For this question, you will write a program that takes a secret word of your choice and displays the individual letters for that word at random locations on the canvas This program is non-interactive, so you won't need functions like setup) ordra. Your program's output will just be a stil image of the letters Figure 1: Can you guess what the secret word is? Here are the specifications for this problem: Use a 300x30O black canvas . The default text size is too small: use the textSize function to change the text size to 30. . Use a for-loop to display each of the letters from your secret word at a random location on the canvas. Your code must work for any secret word (ie use a single variable that you set at the top of your program to refer to your word) To generate random coordinates for a single letter, use these two lines of code: x -int (random (0, 270)) yint(random (30, 300)) The random) function simply returns a random number within the specified bounds: the bounds here have been selected to make sure your letters will always be visible on the canvas. Part 2 Use the PDF library that we learned about in chapter 10 see the lecture slides solutions from Chapter 10 for an example) to generate a PDF image of the output of your program for three different secret words of your choice. Hand in these three images (one for each word) along with your code for this problem. Question 1(5 points): Purpose: To practice using for loops, to practice using simple libraries Degree of Difficulty: Easy Words can be tricky to read when the letters are all jumbled up. For this question, you will write a program that takes a secret word of your choice and displays the individual letters for that word at random locations on the canvas This program is non-interactive, so you won't need functions like setup) ordra. Your program's output will just be a stil image of the letters Figure 1: Can you guess what the secret word is? Here are the specifications for this problem: Use a 300x30O black canvas . The default text size is too small: use the textSize function to change the text size to 30. . Use a for-loop to display each of the letters from your secret word at a random location on the canvas. Your code must work for any secret word (ie use a single variable that you set at the top of your program to refer to your word) To generate random coordinates for a single letter, use these two lines of code: x -int (random (0, 270)) yint(random (30, 300)) The random) function simply returns a random number within the specified bounds: the bounds here have been selected to make sure your letters will always be visible on the canvas. Part 2 Use the PDF library that we learned about in chapter 10 see the lecture slides solutions from Chapter 10 for an example) to generate a PDF image of the output of your program for three different secret words of your choice. Hand in these three images (one for each word) along with your code for thisStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started