Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need to Draw Letters F & F in Python EXAMPLE Goal: Draw two letters using *characters. Write your letter to an output file. Look

I need to Draw Letters F & F in Python image text in transcribedEXAMPLE

image text in transcribed

image text in transcribed

Goal: Draw two letters using "*"characters. Write your letter to an output file. Look up your letter assignments here. Relevant Examples: LetterH LetterZ French Flag LetterHPpm LetterZPpm Restriction: when drawing letters, you must use double loops for which the action only prints one character (such as "*") at a time. Important: Draw a hand sketch of your letter before you start writing any code. Optional: If you wish, draw your letter in a PBM or .PGM, or .PPM image file as with the French Flag Example. Sometimes the file extension .PNM Portable Any Map) is used generically to indicate that any one of the three file formats PBM, PGM, or PPM is being used. If you expect to obtain an A in IT 211, your Project 3 Ruby script should produce a letter in a .PNM file. 1. For a .PBM (Portable Bit Map) file, each pixel consists of O or 1, depending on whether the image is black or white, respectively. The header in the first line of a PBM file is P1 100 80 where P1 is the magic number, 100 is the image width, and 80 is the image height. Here is a complete tiny image: P1 3 3 0 1 0 11 0 o 0 1 2. For a . PGM (Portable Greylevel Map) file, each pixel is a number between 0 and 255 inclusive, which represents a gray level. The first line of the file is a header like this def draw top space: for y in range(0, 30): for x in range(e, 200): draw backgroundpixel fout.write(" ") def draw horizontal bar( for y in range (30, 50) for x in range(e, 40): for x in range(40, 160): for x in range(160, 200): fout.write(" ") draw backgroundpixel draw foreground pixel draw backgroundpixel def draw diagonal bar: for y in range(5e, 140): for x in range(e, 180 - y): for x in range(180 - y, 210 - y): for x in range(210 - y, 200): fout.write(" ") draw backgroundpixel draw foreground pixel draw backgroundpixel def draw bottom space( for y in range(140, 200): for x in range(1, 200): draw backgroundpixel fout.write(" ") write graphics file header( draw top space draw horizontal bar( draw diagonal_bar() draw horizontal bar( draw bottom space() fout.close) Goal: Draw two letters using "*"characters. Write your letter to an output file. Look up your letter assignments here. Relevant Examples: LetterH LetterZ French Flag LetterHPpm LetterZPpm Restriction: when drawing letters, you must use double loops for which the action only prints one character (such as "*") at a time. Important: Draw a hand sketch of your letter before you start writing any code. Optional: If you wish, draw your letter in a PBM or .PGM, or .PPM image file as with the French Flag Example. Sometimes the file extension .PNM Portable Any Map) is used generically to indicate that any one of the three file formats PBM, PGM, or PPM is being used. If you expect to obtain an A in IT 211, your Project 3 Ruby script should produce a letter in a .PNM file. 1. For a .PBM (Portable Bit Map) file, each pixel consists of O or 1, depending on whether the image is black or white, respectively. The header in the first line of a PBM file is P1 100 80 where P1 is the magic number, 100 is the image width, and 80 is the image height. Here is a complete tiny image: P1 3 3 0 1 0 11 0 o 0 1 2. For a . PGM (Portable Greylevel Map) file, each pixel is a number between 0 and 255 inclusive, which represents a gray level. The first line of the file is a header like this def draw top space: for y in range(0, 30): for x in range(e, 200): draw backgroundpixel fout.write(" ") def draw horizontal bar( for y in range (30, 50) for x in range(e, 40): for x in range(40, 160): for x in range(160, 200): fout.write(" ") draw backgroundpixel draw foreground pixel draw backgroundpixel def draw diagonal bar: for y in range(5e, 140): for x in range(e, 180 - y): for x in range(180 - y, 210 - y): for x in range(210 - y, 200): fout.write(" ") draw backgroundpixel draw foreground pixel draw backgroundpixel def draw bottom space( for y in range(140, 200): for x in range(1, 200): draw backgroundpixel fout.write(" ") write graphics file header( draw top space draw horizontal bar( draw diagonal_bar() draw horizontal bar( draw bottom space() fout.close)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions