0% found this document useful (0 votes)
61 views1 page

Practice 7 30424 ENG

This document provides instructions for two Python exercises using various modules: 1) Create an Excel file to store student grades using openpyxl and os modules. The program will prompt the user to name the file and worksheets, insert labels and scores, calculate averages, and save the file. 2) Use the webbrowser module to open the Wikipedia page for a city chosen by the user. Research how Wikipedia URLs are formed for city pages first.

Uploaded by

ka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views1 page

Practice 7 30424 ENG

This document provides instructions for two Python exercises using various modules: 1) Create an Excel file to store student grades using openpyxl and os modules. The program will prompt the user to name the file and worksheets, insert labels and scores, calculate averages, and save the file. 2) Use the webbrowser module to open the Wikipedia page for a city chosen by the user. Research how Wikipedia URLs are formed for city pages first.

Uploaded by

ka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Computer science (code 30424) a.y.

2018-2019

Practice 7 – Modules and libraries

To carry out each exercise, use the Python modules specified in the text.

You are asked to solve the following exercises:

1) Create a new Excel file – saving it on a disk – to manage the grades of the first semester

Create a program in Python (to be saved with the name Exercise_1.py), which performs the
following actions, making use of the objects available in the openpyxl and os modules. More
specifically the program will have to:

 Create a new Excel file, saving it in an existing folder named “Excel exercise”. The folder
should be previously created (by you) in a path of your choice on your computer (e.g.
C:\Excel exercise). The name to be assigned to the file must be requested to the user
during the creation phase (without specifying the extension .xlsx, which must be added
during the execution of the program).
 Create as many worksheets as the user wants to insert, assigning to each of them the
name that the user should be prompted to specify.
 In the active worksheet (that is, by default, the first among those just created), insert the
labels "Exam" and "Score", respectively in cells A1 and B1.
 A tuple must be defined, containing the following names: "Economics", "Mathematics",
"History" and "Law".
 The program will have to let the user enter – one by one (by column) – the scores of
each exam, starting from row 2. In particular, column A will have to show the names of
the courses and column B will have to host the correspondent scores entered by the
user.
 In the first row below the name of the last course (column A), insert the label “Average”.
 In the corresponding cell on the right (column B) enter the average value of the scores,
calculated using the appropriate function available in Excel.
 Remember to make sure that any changes made to the Excel file just edited are saved
before the execution of the program ends.
 To close the procedure of creation of the Excel file, show to the user the message: "The
creation of the file FileName.xlsx has been completed. Thank you!”.

To verify the correct functioning of the code, create an Excel file (with name and as you like),
containing at least three worksheets.

2) Search on Wikipedia of the page of a city chosen by the user

Using the objects available in the webbrowser library, create a program with Python (to be
saved with the name Exercise_2 - Wikipedia.py) that shows in the default web browser the
Wikipedia page for a city chosen by the user. Before proceeding, perform some research on
Wikipedia to analyze the way in which the URL of the results pages is formed.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy