Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
79 views

SAS Week 1 Python Primer

This document provides an activity sheet for a lesson on Python for students taking a data structures and algorithms course. The lesson objectives are to create Python programs and get an introduction to the Python programming language. It outlines the materials, references, and sustainable development goals covered. It then provides concept notes on Python and the Spyder IDE. It lists 9 guided exercises for students to complete hands-on practice creating Python programs to test basic programming concepts. It concludes with a hands-on exam for students to demonstrate their Python skills.

Uploaded by

gehop
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views

SAS Week 1 Python Primer

This document provides an activity sheet for a lesson on Python for students taking a data structures and algorithms course. The lesson objectives are to create Python programs and get an introduction to the Python programming language. It outlines the materials, references, and sustainable development goals covered. It then provides concept notes on Python and the Spyder IDE. It lists 9 guided exercises for students to complete hands-on practice creating Python programs to test basic programming concepts. It concludes with a hands-on exam for students to demonstrate their Python skills.

Uploaded by

gehop
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Data Structures and Algorithm

Week 1 – Day 3
Information Technology Department

STUDENT ACTIVITY SHEETS

Materials
Computer, Student Activity Sheet, PPT
PYTHON PRIMER
References
Intended Learning Outcomes Beginning Java Data Structures and Algorithms by James
Cutajar
At the end of the lesson, you should be able to:
Data Structures for Gujarat Technological University by
 Create programs using Python programming language Reema Thareja
Data Structure and Algorithmic Thinking with Python by
Narasimha Karumanchi

SDG Integration
SDG # 4 – Quality Education (Ensure inclusive and equitable quality
education and promote life-long learning opportunities for all
SDG # 5 – Gender Equality (Achieve gender equality and empower all
women)
SDG # 9 – Innovation and Infrastructure (Build resilient infrastructure,
promote inclusive and sustainable industrialization and foster innovation

Name: __________________________________________ Course & Section: _____________


Lesson Preparation/ Review/Preview (15 minutes)
Directions: Review the programming languages that you have currently learned.

Survey the students what programming language they have mastered so far (Poll Survey)

CC214 / CC214 L : Albarracin ‘22 1


Concept Notes Presentation (40 minutes)

Points to Remember

PYTHON PRIMER
Spyder: Python IDE for Absolute Beginners (Need to install Anaconda Distribution)

Spyder is an IDE aimed at mainly scientific researchers, data analysts, or those involved in scientific package
creation. Spyder’s developers have designed it to be the ideal tool for developing Python applications, and
Spyder itself has been created using Python.

Editor: This is where we will write our code.

Console: When we run our code(we will see how to do it in a while), the outputs/errors from our code will be
displayed here. We can also give single-line commands in the console for instant output. There are many more
important uses of it. We will discuss them later.

Variable Explorer

You can see all the variables created by running your code in this variable explorer. It shows you the Name,
Type, Size, and some values of the variable. you can also search for a variable by its name, erase single or all
the variables at a time.

CC214 / CC214 L : Albarracin ‘22 2


CC214 / CC214 L : Albarracin ‘22 3
Guided Practice (30 minutes)

HANDS – ON ACTIVITY: Take s screenshot of the Python script and the sample output.
Submit it in PDF via GClassroom

Exercise#1
Create a program that asks the user to enter their name and their age. Print out a message addressed to
them that tells them the year that they will turn 100 years.

Exercise #2
A store sells baking products at P650 and pastries at P350. Write a program that inputs the number of
baking products and pastries bought and output the bill. Assume that your program will ask the buyer to
input amount to pay. Output the change to be given by the buyer.

Exercise #3
Make a python program that will accept to integers and display the sum, difference , product , quotient and
average.

Exercise #4
Make a program that asks the user for a number. Depending on whethere the number is even or odd,
printout an appropriate message to the user.

Exercise #5
Take a list, say for example this one: a = [1, 3, 5, 343, 56, 78, 34, 12, 90]. Write a program that print outs
all the elements of the list that are less than 30.

Exercise #6
Create a program that askes the user for a number and then prints out a list of all the divisors of that
number.

Exercise #7
Take a list, say for example these two:
A= [1, 2, 3, 6, 12, 55, 23, 78, 89, 1]
B= [ 1, 2, 3, 4, 5, 6, 12, 24, 32]
Write a program that returns a list that contains only the elements that are common between the lists
(without duplicates). Make sure your program works on two lists of different sizes.

Exercise #8
Write a program that asks the user for a string and print out whether this string is a palindrome or not. ( A
palindrome is a string that reads the same forwards and backwards.

Exercise #9
Let’s say I give you a list saved in a variable”
a = [1,4,5,34, 655, 56, 75,3]
Write a one-line Python code that takes this list a and makes a new list that has only the even elemeents of
this list in it.

CC214 / CC214 L : Albarracin ‘22 4


CompuSkill (Performance)

HANDS – ON EXAM:

CC214 / CC214 L : Albarracin ‘22 5


CC214 / CC214 L : Albarracin ‘22 6
CC214 / CC214 L : Albarracin ‘22 7
CC214 / CC214 L : Albarracin ‘22 8

You might also like