Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using python, how does one import a 2D list from a text file, change all non-zero values in the list to a value of 255,

Using python, how does one import a 2D list from a text file, change all non-zero values in the list to a value of 255, and then save the new/altered 2D list as a new file?

the contents of file.ppm are displayed below

100 0 90 252 0 54 100 0 204 214 0 79 219 0 97 78 0 53 12 0 14 220 0 198 100 0 90 252 1 54 0 0 114 214 1 79 219 1 97 51 1 53 112 1 114 220 0 98 100 0 0 52 1 154 200 0 204 140 1 79 219 1 97 51 0 53 112 1 14 220 0 98 0 0 190 52 1 54 012 1 14 214 1 200 119 1 190 25 0 153 130 1 14 220 0 98 100 0 170 152 0 54 12 1 14 150 0 79 219 1 97 51 0 53 12 1 14 220 0 98 100 0 150 52 0 54 250 1 214 214 0 13 219 1 180 125 0 0 12 1 214 220 0 98 0 0 90 52 0 154 12 1 0 214 0 79 219 1 97 151 1 53 12 1 14 220 0 98 100 0 140 152 0 0 12 0 214 190 0 79 219 0 150 25 0 53 12 0 14 0 0 98

for all non-zero values, reset these values to a new value of 255.

save the new 2d list as newfile.ppm

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

Recommended Textbook for

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions

Question

How to reverse a Armstrong number by using double linked list ?

Answered: 1 week ago