use PYTHON Even though Windows and macOS sometimes hide them, most files have file extensionsLinks to an external site., a suffix that starts with a period (.) at the end of their name. For instance, file names for GIFsLinks to an external site. end with .gif, and file names for JPEGsLinks to an external site. end with .jpg or .jpeg. When you double-click on a file to open it, your computer uses its file extension to determine which program to launch. Web browsers, by contrast, rely on media typesLinks to an external site., formerly known as MIME types, to determine how to display files that live on the web. When you download a file from a web server, that server sends an HTTP headerLinks to an external site., along with the file itself, indicating the file’s media type. For instance, the media type for a GIF is image/gif, and the media type for a JPEG is image/jpeg. To determine the media type for a file, a web server typically looks at the file’s extension, mapping one to the other. See developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_typesLinks to an external site. for common types. In a file called extensions.py, implement a program that prompts the user for the name of a file and then outputs that file’s media type if the file’s name ends, case-insensitively, in any of these suffixes: .gif .jpg .jpeg .png .pdf .txt .zip Please see attache photos for Demo and Test  use PYTHON

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter12: Using Controls
Section: Chapter Questions
Problem 13RQ
icon
Related questions
Question

use PYTHON

Even though Windows and macOS sometimes hide them, most files have file extensionsLinks to an external site., a suffix that starts with a period (.) at the end of their name. For instance, file names for GIFsLinks to an external site. end with .gif, and file names for JPEGsLinks to an external site. end with .jpg or .jpeg. When you double-click on a file to open it, your computer uses its file extension to determine which program to launch.

Web browsers, by contrast, rely on media typesLinks to an external site., formerly known as MIME types, to determine how to display files that live on the web. When you download a file from a web server, that server sends an HTTP headerLinks to an external site., along with the file itself, indicating the file’s media type. For instance, the media type for a GIF is image/gif, and the media type for a JPEG is image/jpeg. To determine the media type for a file, a web server typically looks at the file’s extension, mapping one to the other.

See developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_typesLinks to an external site. for common types.

In a file called extensions.py, implement a program that prompts the user for the name of a file and then outputs that file’s media type if the file’s name ends, case-insensitively, in any of these suffixes:

  • .gif
  • .jpg
  • .jpeg
  • .png
  • .pdf
  • .txt
  • .zip

Please see attache photos for Demo and Test 

use PYTHON

Demo
$ python extensions.py
File name: cat.gif
image/gif
$ python extensions.py
File name: cat.jpg
image/jpeg
$ python extensions.py
File name: cat.jpeg
image/jpeg
Transcribed Image Text:Demo $ python extensions.py File name: cat.gif image/gif $ python extensions.py File name: cat.jpg image/jpeg $ python extensions.py File name: cat.jpeg image/jpeg
Run your program with python extensions.py. Type happy.jpg and press Enter. Your program should output:
image/jpeg
• Run your program with python extensions.py. Type document.pdf) and press Enter. Your program should output:
application/pdf
Transcribed Image Text:Run your program with python extensions.py. Type happy.jpg and press Enter. Your program should output: image/jpeg • Run your program with python extensions.py. Type document.pdf) and press Enter. Your program should output: application/pdf
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Principles of Information Systems (MindTap Course…
Principles of Information Systems (MindTap Course…
Computer Science
ISBN:
9781285867168
Author:
Ralph Stair, George Reynolds
Publisher:
Cengage Learning
Fundamentals of Information Systems
Fundamentals of Information Systems
Computer Science
ISBN:
9781305082168
Author:
Ralph Stair, George Reynolds
Publisher:
Cengage Learning
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
New Perspectives on HTML5, CSS3, and JavaScript
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning