Automating Real World Tasks with Python Week 1 Solution

Share on facebook
Share on twitter
Share on linkedin
Share on telegram
Share on whatsapp

In the final course, we’ll tie together the concepts that you’ve learned up until now. You’ll tackle real-world scenarios in Qwiklab’s that will challenge you to use multiple skills at once. this assignment consists of Qwiklab’s Assessment: “Scale and Convert Images using PIL“.

First, we’ll take a closer look at how to use external Python modules to extend your code’s capabilities, and spend some time learning how to use documentation to learn a new module. For example, we’ll use the Python Image Library (PIL) to create and modify images.

We’ll show you some simple examples of how to perform common tasks in the course material, but it will be up to you to explore the module documentation to figure out how to solve specific problems. Next, we’ll show you how to communicate with the world outside of your code! You’ll use data serialization to turn in-memory objects into messages that can be sent to other programs.

Your program will send messages across the network to Application Programming Interfaces (APIs) offered by other programs. For those times when your code needs to talk to a person instead of a program, you’ll also learn to send email messages. At the end of this course, you’ll be able to take a description of a problem and use your skills to create a solution — just like you would on the job. In your final capstone project, you’ll be given a description of what your customer needs, and it will be up to you to create a program to do it!

~~SKILLS YOU WILL GAIN~~

  • Serialization
  • Building a Solution
  • Creating and Translating Media Files
  • Interacting with Web Services

Course Link Click here

Qwiklab’s Assessment: “Scale and Convert Images using PIL”

Code:-

				
					#!/usr/bin/env python3
import os, sys
from PIL import Image

size = (128, 128)

for infile in os.listdir():
    outfile = os.path.splitext(infile)[0]
    try:
        with Image.open(infile).convert('RGB') as im:
            im.thumbnail(size)
            im.rotate(270).save("/opt/icons/" + outfile, "JPEG")
    except OSError:
        pass
				
			

3 thoughts on “Automating Real World Tasks with Python Week 1 Solution

  1. Wow, incredible weblog layout! How long have you been running a blog for? you make running a blog look easy. The total glance of your site is excellent, let alone the content.

  2. You couⅼd certainly see your skills in the article you write. The world hopes for more passionate writеrs such as you who arеn’t afraid to say how they believe. At all times follow your heart.

Leave a Reply

Your email address will not be published. Required fields are marked *