Didactic Guide (Programming) Fifth Semester
Didactic Guide (Programming) Fifth Semester
Information Systems
Page 151
COBATAB
TABASCO HIGH SCHOOL
TABASCO
“Education that generates
change”
Development of
Systems
i Didactic Guide 5th
semester
STUDENT DATA
Name:
Squad:
Cluster Shift:
:
“Education that generates change
Reviewed by:
Mtro. Cristy Miguel Selvan Garcia
LIA Karina del Carmen Gomez Lopez
Mtro. Jorge Alberto Almeida Alejandro
This material was prepared under the coordination and supervision of the Academic Directorate of
College of Bachelors of the State of Tabasco
www.cobatab.edu.mx
Choca Walk No. 1000 Col. Tabasco 2000, CP 86035 Villahermosa, Tabasco, MX
Tel.+52 (933)3 16 93 11
CO BATA
TABASCO B
“Education that generates
change”
CONTENT
Page 1
“Education that generates change”
Presentation
The purpose of this teaching guide is to guide the student in acquiring knowledge in the development of
information systems.
In the technological world we currently live in, we must not only be consumers of information; we must change
our perspective and become producers of it.
This is why the Information Systems submodule proposes introducing students to this new perspective, starting
from the needs of their own educational institution, by creating an information system for the school library or
their community.
The student is guided step by step in the acquisition of theoretical knowledge and in its application, through the
methodology of systems development in the didactic situation called: “My library is great”.
In this way, generic skills in the use of ICT and the willingness to work collaboratively are strengthened, as well
as professional skills by proposing their own information system according to the needs of their educational
context, thereby making the student see one of the job opportunities that exist.
We hope that this guide will be useful for our educational community and will be enriched by your
contributions.
1. He knows and values himself and approaches problems and challenges taking into account the objectives
he pursues.
CG1.1 Faces the difficulties that arise and is aware of his/her values, strengths and weaknesses.
CG1.2 Identifies his/her emotions, manages them constructively and recognizes the need to ask for support
when faced with an overwhelming situation.
CG1.3 Choose alternatives and courses of action based on supported criteria and within the framework of a life
project.
CG1.4 Critically analyze the factors that influence decision-making.
CG1.5 Accepts the consequences of his/her behavior and decisions.
CG1.6 Manage available resources taking into account the restrictions to achieve goals.
2. He is sensitive to art and participates in the appreciation and interpretation of its expressions in different
genres.
CG2.1 Values art as a manifestation of beauty and expression of ideas, sensations and emotions.
CG2.2 Experience art as a shared historical fact that enables communication between individuals and cultures in
time and space, while developing a sense of identity.
CG2.3 Participate in art-related practices.
4. Listen, interpret and send relevant messages in different contexts using appropriate media, codes and
tools.
CG4.1 Express ideas and concepts through linguistic, mathematical or graphical representations.
CG4.2 Applies different communication strategies depending on who the interlocutors are, the context in which
they find themselves and the objectives they pursue.
CG4.3 Identify key ideas in a text or oral speech and draw conclusions from them.
CG4.4 Communicates in a second language in everyday situations.
CG4.5 Manage information and communication technologies to obtain information and express ideas.
Think critically and reflectively.
6. Supports a personal position on topics of general interest and relevance, considering other
points of view in a critical and reflective manner.
CG6.1 Choose the most relevant sources of information for a specific purpose and discriminate
between them according to their relevance and reliability.
CG6.2 Evaluate arguments and opinions and identify biases and fallacies.
CG6.3 Recognizes own biases, modifies points of view when faced with new evidence, and
integrates new knowledge and perspectives into the available body of knowledge.
CG6.4 Structure ideas and arguments in a clear, coherent and synthetic manner.
Learn independently.
Works collaboratively.
Page 1
Participate responsibly in society.
9. Participate with a civic and ethical conscience in the life of your community, region, Mexico
and the world.
CG9.1 Favors dialogue as a mechanism for conflict resolution.
CG9.2 Make decisions in order to contribute to the equity, well-being and democratic development
of society.
CG9.3 Knows his rights and obligations as a Mexican and member of different communities and
institutions, and recognizes the value of participation as a tool to exercise them.
CG9.4 Contributes to achieving a balance between individual interest and well-being and the
general interest of society.
CG9.5 Acts in a proactive manner in the face of social phenomena and stays informed.
CG9.6 Notes that phenomena that develop at local, national and international levels occur within
an interdependent global context.
10. Maintains a respectful attitude towards interculturality and the diversity of beliefs, values,
ideas and social practices.
CG10.1 Recognizes that diversity takes place in a democratic space of equal dignity and rights for all
people, and rejects all forms of discrimination.
CG10.2 Engage in dialogue and learn from people with different viewpoints and cultural traditions
by placing their own circumstances in a broader context.
CG10.3 Assume that respect for differences is the principle of integration and coexistence in local,
national and international contexts.
Page 2
2. Prepares information through data manipulation and formulas, CPBTIC2
creating graphics in a spreadsheet application, creatively and innovatively solving situations in
various environments and contexts.
3. It proposes the use, creation and administration of electronic platforms of CPBTIC3
consultation, communication and distribution of multimedia content, proposing virtual
communities that allow communication, promoting self-learning in an innovative environment in
its different contexts.
4. Develops corrective actions for equipment operation problems CPBTIC4
computing, through the application of preventive and corrective maintenance according to the
manufacturer's specifications, prolonging the useful life of the equipment, showing responsibility
and initiative in various areas.
5. Proposes the design of information systems, based on the analysis of the CPBTIC5
user needs, allowing for responsible and innovative problem solving in different contexts.
6. Build organizational information systems by coding and compiling relevant algorithmic
instructions using programming languages and databases to meet the functionality and
performance requirements established in the design of information systems, assuming
frustration as part of the process in work, educational and everyday life environments.
7. Build creative and functional websites using web design software, CPBTIC7 to transmit
diverse electronic information on a large scale in a responsible and empathetic way in work,
educational and everyday life contexts.
8. Create various advertising graphic resources using design software, CPBTIC8
allowing their publication in digital and print media to communicate ideas or emotions
applicable to work, school and everyday life contexts, in an ethical and innovative environment,
showing flexibility and openness to different points of view
Focus of Discipline
The training in Information and Communication Technologies belongs to the disciplinary field of
Communication, its purpose is to develop in the students the communicative, verbal and non-
verbal skills to express themselves through various codes and language tools through different
information technologies. On the other hand, Information and Communication Technologies are
linked in an interdisciplinary way with both the field of Mathematics and Communication, since
they provide the elements for problem solving through algorithms and programming.
The general purpose of Information and Communication Technologies training is: To develop the
ability to propose solutions to problems in the work and school context, through the application of
Information and Communication Technologies, in a creative and innovative way, with an ethical
and responsible stance as a digital citizen.
The use of Information and Communication Technologies, from this training, highlights the
advanced management of software and hardware applications for solving problems in different
areas of daily life, developing methodological, creative and communicative aspects, without
forgetting a proactive behavior for personal benefit and within society.
Page 3
well as the continuation of their studies at a higher level.
In the curricular context of the training in Information and Communication Technologies, the
content is divided into four modules that are taught from the third semester with a workload of 7
hours per week, each module is made up of two submodules that seek to develop the
management of office applications that allow the creation of electronic documents with advanced
features using the word processor and the spreadsheet, create and participate in virtual
communities for the exchange of information including the educational field, apply maintenance to
the computer equipment; for the development of systems based on databases and programming,
through the creation of web pages and design software to communicate ideas and information, in
the work and school environment.
All these skills enable graduates to enter the workforce or to develop independent production
processes in accordance with their professional interests or the needs of their social environment
as an assistant in the following areas:
administrative, technical support, systems area, advertising, and others, in different public and
private institutions.
The teaching of Information and Communication Technology Training in youth job training, based
on the Technical Standards of Labor Competence (NTCL) of the National Council for Standardization
and Certification of Labor Competencies (CONOCER) becomes a first-order need to meet the
demands of the productive sectors, to have qualified personnel that allows developing the
potential of their organizations by promoting products and services both in the national and
international markets, in addition to providing basic technical tools to students graduating from
high school, which will allow them to overcome borders and enter the global world through
information and communication technologies (ICT'S), in addition to the use of learning and
knowledge technologies (TAC'S).
CINF0376.01 Preparation of documents and communication through the use of advanced features
of computer applications
UINF0948.01 Prepare text documents by using the advanced features of the computer application
UINF0949.01 Create spreadsheets using the advanced features of the computing application
Page 4
Location of the Subject or Module
Page 5
Training map
Disciplinary Field: Communication
Submodule
1Text file
management
48 hours
6 credits
Submodule
2Applied spreadsheets
64 hours
8 credits
Submodule
1Virtual communities
48 hours
6 credits
Submodule
2Maintenance and
computer networks64
hours
8 credits
Page 6
Symbolism
Icon Description
Reading: In this section you will find a reading in accordance with the study plan that
provides the necessary knowledge to complete the scheduled activities.
Audio-visual material: made up of both QR and URL links to facilitate access to relevant
information that complements an activity
Practice plan A: guided practices that help in the application of the knowledge
obtained, accompanied by the corresponding evaluation instrument.
Plan B Activity: Optional activities for schools that are unable to carry out a practice,
taking up the necessary elements of each reading.
Teacher explains: It is suggested that in this section the teacher deepens their
knowledge to adapt it to their context.
“Education that generates change”
PROGRAMMATIC DOSING
Submodule 1 CPBTIC5 Systems Development
CPBTIC6 Submodule 2 Programming
Sem: 5th. Period: 2021B (64 HRS)
Moment Time
Block Knowledge Week Start date Observations
(minutes)
1
Module Framework
Activity Build-T
2 240 Diagnostic Assessment 8 Oct 11-15
Programming logic,
3 Algorithms, Flowchart,
Pseudocode
240 Decisions, Cycles 9 Oct 18-22
SUBMODULE II: PROGRAMMING
Programming languages
420 Types of languages, 10 Oct 25-29
Programming
methodology Structured
Object-oriented
Programming using a
4 high-level language. November 1st and 2nd
420 Development 11 03-05 Nov. Official suspension of
environment variables, work
operators Constants
420 Reserved words
12 08-12 Nov.
Decision sentence
420 Structures 13 Nov 16-19
420 Condition, Repetition 14 Nov 22-26
420
Arrangements 15 Nov 29-Dec 3
5 420 Teaching situation 16 07-10 Dec.
6 420 Feedback 17 Dec 13-17
Totals 3,840
Evaluation criteria
Total 100%
Module IIISystems
Development
Submodule 2. Programming
HTML5
Python
Ard
uin
o
Information Systems .. ..
Page 11
Module III Systems Development
Competencies
Generic Professionals
• CG5.2 Sorts information from
according to categories, hierarchies
and relationships.
• CG5.6 Uses information technology • CPBTIC5 Proposes the design of
technologies information systems, based on the
information and communication to analysis of user needs, allowing for
process and interpret information responsible and innovative problem
• CG8.1 Proposes ways to solving in different contexts.
solve a problem or develop a team
project, defining a course of action
with specific steps
Information Systems
Page 12
“Education that generates change”
Teaching Situation
Context: In daily life, students use technology indiscriminately and do not make good use
of it. Accordingly, it is sought that they generate technological environments
integrating various areas of knowledge in order to acquire general and specific
programming skills in a responsible, analytical and critical way, allowing them to
address everyday problems and develop programs that benefit the institution and
the context, integrating them into a portfolio of evidence.
Information Systems
Page 13
Diagnostic evaluation.
Name. Cluster.
1. Mention what is the process by which the software is designed, coded, cleaned and protected?
source code of computer programs?
a) Database
b) Programming
c) Software
d) Block diagram
2. Choose. What iscreate software, which will then be executed directly by the
computer hardware, or through another program?
a) Objective of programming
b) Advantage of programming
c) Disadvantage of programming
d) Programming risks
Page 14
Information Systems
It is written in normal language
d) It is the representation oftables
c) b) Qualitative algorithm
c) Quantitative algorithm
d) Pseudocode
6. Choose. What is the environment used to structure, plan and control the process of
systems development?
a) Methodology for software development
b) Definition of needs
c) Analysis
d) Design
7. Choose. What is the stage where the requirements for the development of the
software?
a) Methodology for software development
b) Definition of needs
c) Analysis
d) Design
Information Systems
Page 15
CO BATA B
TABASCO HIGH SCHOOL
TABASCO
'Education that generates
change'
10. Choose. It is the set of tools that allow the programmer to develop computer programs, using
different alternatives in a practical way.
a) Programming language
b) Algorithm
c) Programming software
d) Programming logic
Information Systems
Page 16
CO BATA B
TABASCO HIGH SCHOOL
TABASCO
'Education that generates
change'
d) Programming language
12. Select. It is a structured communication system that allows us to communicate, either through
words, signs, sounds or gestures with a computer.
a) Programming logic
b) Programming language
c) Programming software
d) Pseudocode
13. Choose. It is the process by which source code is written, tested, debugged, compiled (if
necessary) and maintained.
a) Programming
b) Pseudocode
c) Structured programming
d) Object Oriented Programming
15. Choose. It is a programming paradigm that uses objects in their interactions to design computer
applications and programs. It is based on several techniques, including inheritance, cohesion,
abstraction, polymorphism, coupling and encapsulation.
a) Object-oriented programming.
b) Programming
Information Systems
Page 17
Structured programming
d) Pseudocode
modified. TABASCO
'Education that generates
change'
a)
c)
Structure sequential
b) Control structures
c) Structure selective
d) Structurecyclical
18. Choose. Evaluates a logical expression, if it is true it executes one or more actions, if not true it
executes nothing.
a) Structure selective
b) Structure sequential
c) Control structures
d) Structurecyclical
19. Select. They allow the execution of an action or a group of actions to be repeated a determined
or indeterminate number of times.
a) Selective structure
b) Cyclic structure
Information Systems
Page 18
c) Sequential structure
d) Control structure
20. Choose. They increase the flexibility of the function by expanding the number of possible results
to test.
a) Nested cycle
b) Conditionmultiple
c) Condition nested
d) Condition simple.
Page 19
Information Systems
Reading 1 Programming logic.
Pelhon (2019) states that “programming logic is the coherent organization of the program instructions
so that its objective is achieved”, for which he recommends that the information be clear and organized
so that it contributes to the objectives that are desired to be achieved. On the other hand, anyone who
intends to build a program that provides a solution to a certain problem faces two major tasks:
• The WHAT: actions to be taken to resolve the problem. This task is part of the desk work prior to
any programming activity.
• The HOW: instructions that will be used to write the code that performs the actions determined in
the WHAT, which are determined by the programming language
selected.
Many people confuse Programming with Programming Logic, the first involves the knowledge of
techniques and instructions of a certain Language through which it is easy to get the Computer to
obtain results much faster than a person. The
second involves, in a technical and organized
way, the concepts that allow
Page 20
Information Systems
design, in general terms, the solution to problems that can be implemented through a computer.
(Ecured, 2021)
Logic is the basis of all programming knowledge, since it is possible to learn to write code so that the
computer can interpret it correctly. That is, you learn to communicate with the machine through a
language.
Programming logic is the organization and planning of coherent instructions in an algorithm, with the
aim of making the implementation of a program or software visible.
1.1.-Algorithm.
executed again)
carried out through successive steps that do not 3. If the answer is YES then is the bulb burned out?
4. If the answer is YES then we replace the focus and the algorithm ends.
generate doubts for the person who must carry out (can optionally be run again)
said activity. In a scenario with an initial state and an 5. If the answer is NO then it means that the lamp is damaged and we
proceed to buy a new lamp.
Precise: and indicate the order in which each step is carried out.
Defined: If you follow an algorithm twice, you must get the same result each time.
Page 21
Information Systems
There are algorithms, Quantitative (numerical calculations are used to define the steps of the process)
and Qualitative (steps in a Narrated form.)
Figure taken from Ferreyra, G. (2011). Computer Science Step by Step. Alfaomega Publishing Group.
Mexico. Pp. 26-29
Page 22
Information Systems
COBATAB
TABASCO HIGH SCHOOL
TABASCO
“Education that generates
change”
represents the algorithm through a diagram using various graphic symbols, called "blocks", in which
the actions that the algorithm must execute are described, connected to each other by lines
indicating the order in which the instructions must be carried out.
Various geometric figures such as rhombuses, squares or circles are often used to create a flow
chart.
Flowcharts help to solve and structure a problem.
Page 23
Information Systems
1.2. -Flow chart.
Flowcharts are based on symbols that allow us to say the same thing as in algorithms, but in a graphical
way and, of course, a little more understandable. The following are some of the symbols (and their
meaning) that have been agreed to be used within Flowcharts
or Flowcharts: (Ecured.2021)
2. The symbols are joined by lines, which have an arrow at the tip indicating the
direction in which information flows processes, only horizontal or vertical flow lines should be used
(never diagonal).
3. Crossing of lines should be avoided, which would result in separating the flow of the diagram to
a
different site, could be done using the connectors. It should be noted that connectors will only be used
when strictly necessary.
5. All text written inside a symbol must be legible, precise, avoiding the use of
Information Systems
Page 24
many words.
6. All symbols can have more than one input line, except the final symbol.
7. Only decision symbols can and should have more than one output flow line.
Flowcharts are extremely relevant in different technical areas where it is necessary to establish a certain
sequence of steps in a comprehensible way.
Information Systems
Page 25
Examples of the application of the symbology of Flowcharts in Pseudocodes:
There are 3 ways to represent algorithms according to Flowcharts, which are presented below:
Flowcharts with sequential, selective and iterative control structure (Cycles and loops.)
Information Systems
Page 26
A flowchart can be made using different computer tools that make the issue extremely easy, such as
Power Point, SmartDraw, and Lucidchart. Etc.
1.3. Pseudocode.
It is a technique used to write computer programs in natural language in such a way that it facilitates
if lamp plugged in correctly = false then
understanding, testing and subsequent coding in a plug in lamp
end (can optionally be run again) else focus is burned
specific programming language (Gómez, 2021). = true
replace light bulb
end (optionally can be run again) buy new lamp
For example:
START
END
According to Information Technology (2021), when writing pseudocode, users have three basic types of
control structures available: sequential, selective, and iterative.
Page 27
Information Systems
Sequential structures: Instructions are followed in a fixed sequence that is usually defined by the row
number. This means that instructions are executed from top to bottom.
1. Start
2. Read A, B
3. Make S = A + B
4. Write S
5. End
Selective structures: Selective instructions represent instructions that may or may not be executed,
depending on the fulfillment of a condition.
Page 28
1. START
2. WRITE("Enter two numbers");
Information Systems
3. READ( x, z );
4. IF( x > z )
5. WRITE("True");
6. END YES
7. END
Iterative structures (Loops): The iterative or repetition structure allows one or more instructions to be
executed a certain number of times or indefinitely as long as a certain condition is met.
Within this structure, it is common to find COUNTERS (Variable used to count the cycles of the Loops)
• While
• Repeat
• For
• Do
Example: Algorithm that asks for a number and writes its square (Repeat)
1. START
2. Counter <- 0;
3. REPEAT
4. Counter <- Counter + 1;
5. WRITE("Current number: ", Counter);
6. UP TO(Counter == 100 )
7. END
Page 29
CO BATA B
TABASCO HIGH SCHOOL
TABASCO
'Education that generates
change'
There are several advantages to using a Pseudocode for a Flowchart, to mention a few:
Information Systems
Page 30
Information Systems
Instructions: After having analyzed the reading about programming
logic, complete the sun diagram.
Page 31
Information Systems
CO BATA B
TABASCO HIGH SCHOOL
TABASCO
'Education that generates
change'
References
Ferreyra, G. (2011). Computer Science Step by Step. Alfaomega Publishing Group. Mexico. Pp. 26-
29
Gomez, L. A., (2021), Algorithms, Autonomous University of the State of Hidalgo, retrieved from:
https://www.uaeh.edu.mx/scige/boletin/prepa4/n10/e1.html.
Page 32
Information Systems
Instructions: Study the following reading carefully and do the activity My
First Algorithm
2.1. - Decisions.
Decision statements, also called flow control statements, are control structures that ask a question
which returns true or false, evaluate a condition and select the next instruction to execute
depending on the answer or result.
The decisions are represented in the pseudocodes, through a control structure with logical
expression that involves the use of the following symbols:
Action
FinSi
Page 33
Information Systems
Simple decision structure:
Action
EndYes
This type of structure allows you to implement conditionals in which there are two
alternative actions:
Yeah<condición> So
Action(s)
But
Action(s)
FinSi
Page 34
Information Systems
Multiple decision structure:
• If not, that is, if none of the previous conditions have been verified, execute the
instructions in block 3.
Yeah<condición> So
Action(s)
But
Yeah<condición> So
Action(s)
But
Various conditions
The application of decisions and cycles or loops in Algorithms allows solving problems by applying
programming logic with a minimum of steps, offering precise and well-defined results.
Page 35
Information Systems
2.2. - Cycles or loops.
In order to work with these structures, it is necessary to first understand the special loop variables:
Counters and Accumulators.
Page 36
Information Systems
COBATAB
TABASCO TABASCO HIGH SCHOOL
START
START
Integer i LET'S COUNT TO 5
Write "Let's count to 5" -
i=0 II We initialize ia to zero so that in the first comparison it has that value
While (i <= 5)
, 1>5
.-------> FROM i=0 TO 5 -------, // It will repeat the two loop instructions as long as i <= 5 is true
Write i
i=i+1
II In this line the value of i is increased by 1, otherwise it would always be 0.
Write "End"
END
,-
---------------- 1=1+1
Result: 1,2,3,4,5,
TIN"
We can observe the minimum of the written code and the actions it performs in the Flowchart
Information Systems
Page 37
Within the cycles or loops we find the following structures:
STRUCTURE
REPRESENTATION OF
REPETITIVE OR DESCRIPTION EXAMPLE
ALGORITHMS
LOOP
< i.e. 10 B-
the cycle is never
v
executed
If the condition is not CD \
II
met
— C'
Information Systems
Page 38
CO BATA B
TABASCO TABASCO HIGH SCHOOL
longer is
—• i=i+1
puts the
condition. * In n, ** * ",l, ” ° ",
n*l )
the third part (End
the change.
Page 39
Information Systems
➢ Iterative Structure Repeat
unconditionally -------OR
actions
executes a set of
Operations)
l
instructions Increment variable
I False
No
The condition will be a logical proposition, that is, an expression that will either be true or false. If
the condition is true, the set of instructions is executed. When the set of instructions has finished
executing, the flow is directed back to the condition, forming a loop, cycle, or iteration. When the
condition is false, the flow continues to the next statement (branch to the right of the condition
(iterating, 2021).
In general, loops must terminate after a certain (finite) number of repetitions, and the set of
operations to be repeated is known as a loop. (UACJ, 2021)
Page 40
Information Systems
Do you want to learn iterative structures?
https://www.youtube.com/watch?v=E8f1rwUfNG4
https://www.youtube.com/watch?v=as1opL254NA
Information Systems
Page 41
Information Systems
Activity 2: My first algorithm
Instructions: Make your first Iterative algorithm (Loop), which adds the
first 15 natural numbers.
111
References
Information Systems
Page 42
Ecured (2021), Logic of the programming, recovered of
https://www.ecured.cu/L%C3%B3gica_de_programaci%C3%B3n
Guinness, H. (2017). How Facebook's news feed sorting algorithm works. Retrieved from:
https://www.howtogeek.com/290919/how-facebooks-news-feedsorting-algorithm-works/
Department of Differential Equations and Numerical Analysis. Programming algorithms and structures. (March 2,
2009). University of Seville. Website: http://departamento.us.es/edan/php/asig/LICFIS/LFIPC/Tema5FISPC0809.pd
HE PROCESS OF THE PROGRAMMING
http://www3.uacj.mx/CGTI/CDTE/JPM/Documents/IIT/repetitivas/iterativos.html
Exercises loops
https://www.edu.xunta.gal/espazoAbalar/sites/espazoAbalar/files/datos/1554983496/contido/Ro
boticaEnElAula/ejercicios_bucles.html
Exercises of algorithms
http://centros.edu.xunta.es/ieseduardopondal/tecnoweb/temas_informatica/2bac/ejerc_algorit.p df
Information Systems
Page 43
Reading 3: “Programming Languages”
Instructions: Read the following, mark the main ideas and complete the
the suggested activity or the one indicated by your teacher.
Over the years, programming languages have evolved in the development of systems or software,
for this reason, as a programmer it is
important to know the basic concepts of
programming, the types of languages
used for their development and
operation, to interpret algorithms and to
solve problems through programs.
Programming languages are used to design and implement programs responsible for defining and
Broadly speaking, a programming language is made up of a series of symbols and rules of syntax
and semantics that define the main structure of the language and give meaning to its elements and
expressions.
Information Systems
Page 44
computer. The main function of programming languages is to write programs that allow user-
machine communication. Special programs (compilers or interpreters) convert instructions written
in source code into instructions written in machine language (0 and 1).
Interpreters read the instruction line by line and obtain the corresponding machine code. As for
compilers, they translate the symbols of a programming language into their equivalent written in
machine language (a process known as compiling). Finally, an executable program is obtained.
Phases of compilation
Compilation allows the creation of a computer program that can be executed by the computer and
involves three steps:
Page 45
Information Systems
Some compilation processes may have variations, but in
general it looks like this:
Information Systems
Page 46
• Number sequences (0'5 and 1'5)
• Language specific to each computer
✓ Fortran. It was developed in the 1950s and has been actively used ever since (acronym for
Formula Translation).
✓ C++. (High level language). It was designed in the mid-1980s by Bjarne
Stroustrup covers two programming paradigms: structured and object-oriented.
✓ Java. Object-oriented programming language developed by Sun Microsystems in the early
1990s.
✓ PHP. It is frequently used to create content for websites with which HTML pages and
source codes can be programmed. PHP is an acronym that stands for hypertext
preprocessor.
✓ Python. It is a modern programming language, licensed under a free software license; it is
object-oriented, but also supports procedural and functional programming styles.
Page 47
Information Systems
Components of programming languages
more efficiently manipulate diverse variables: numeric or text type (character strings), and other
more complex ones, as
vectors, matrices, pointers, etc.
Instructions
They are predefined grammatical
structures, very similar to human
language, to generate sequences of
actions that make up a program.
They range from basic arithmetic
and logical operators (addition,
subtraction, and, or) to more
specialized instructions to perform various actions within the program, such as saving files,
dumping text to the screen, etc.
Information Systems
Page 48
Flow control
It refers to the sequence of actions of a program. Sometimes, within the sequence of instructions,
there are points where the program must make decisions based on the value of a variable or the
fulfillment of a certain condition. The type of instructions that enable these actions are, precisely,
those of flow control: conditional (if-then-else), loop (for or while) or selection (case).
Page 49
Information Systems
Activity 3. Word Search “Programming Languages”
Instructions. Taking into account the concepts learned in reading 1, answer the following
questions and look for their answers in the following Soup
Information Systems
Page 50
Information Systems
Instructions
8. Object-oriented programming language developed by Sun Microsystems in the early 1990s.
Java
L N V S XAN TO V C TO J
NX P S
D
TO AN T EIT M
C P Y L TO D EIT R AN AN
D HE o HER D D
M AN N AN
OR R TO N TO L Yo T T M N
DY D
D S Ñ EIT
G G D C C TO AN EIT TO EIT
o HE AN TO TO N D HER HER
V TO L D OR T R M YoN Yo
D
TO M N Ñ AN TO P C AN P S EIT C AN C
YM J D D HER D
L D F J W R T Yo S C H C
o
P AN T H EIT N G AN TO R EIT T OR F OR
D HE D HE AN
D F Yo M Yo K T N M S D R G R
D
*TO G OR D N N P OR N TO VOR T OR T
C K EIT Yo Yo V S Yo B H QP SL S
HER
AN N AN
Yo C OR S TO B
L OR N P J N
D
EIT G D
P R R TO M TO C Yo EIT N YoK Yo
HER AN HE
N C P L V R TO OR H J K MN S
EIT D AN D L EIT R T
J OR L F N EIT C TO
HER D HE HER
Page 51
CO BATA B
TABASCO HIGH SCHOOL
TABASCO
'Education that generates
change'
Information Systems
References
Page 52
Information Systems
Reading 4. Structured Programming Methodology
Instructions: Read the following, identifying the main concepts and use them to
create the Concept Map activity at the end.
4.1. - Structured programming
This paradigm is based on the corresponding theorem, which establishes that every computable function can be
implemented in a programming language that combines only these three logical or control structures.
Control structures:
1. The sequential structure is the one that occurs naturally in the language, since by default the
Statements are executed in the order in which they appear written in the program.
Python example
•K
Information Systems
Page 53
2. For conditional or selection structures, Python has the if statement, which
can be combined with -elif and/or else statements. There is a YES or NO decision in its
lines.
Python example
Select! goes. py X
i «Program that asks for age and says whether the person is of legal age or a minor.
2
3 age = int(input(“Tell me your age:”))
4 if age>=18:
s print("You are of legal age")
6else:
7 print("You are a minor")
s print("Program finished")
9 # Write your code here :-)
10
3. For loops or iterations there are the while and for structures. The lines of code will be
repetitive until the condition is met.
Python example
Acids.py X
i # program that asks the user for a password, repeatedly as long as he does not enter “Tics”
2 # When you finally enter the correct password, you will be told “Welcome” and the program will end
3 secret = “Tics”
4 key = input("Tell me the key:")
5 while key != secret:
and print("Incorrect key!!!")
7 key = input("Tell me the key:")
8 pri nt("Welcome!!!")
9 print("Program finished")
Functions:
Structured programming seeks to divide or decompose a complex problem into smaller problems.
The solution to each of these small problems brings us the solution to the complex problem. In
Python, the formulation of these small solutions to the complex problem is done by dividing the
program into functions.
A function is a set of instructions in Python that solve a specific problem. The use of functions is a
very important component of the so-called structured programming paradigm, and has several
advantages:
Page 54
Information Systems
✓ Modularization: allows a complex program to be segmented into a series of simpler parts or
modules, thus facilitating programming and debugging.
✓ Reuse: allows the same function to be reused in different programs.
i function that displays the greeting Hello friend! on the screen Every time she is invoked
2 def greeting():
3 Function that displays the greeting Hello friend! on screen.....................................................
4 print('Hello friend!')
s return
6
7 greeting ()
Executing: function.Dv
[Hi friend!
The Object Oriented Programming paradigm seeks to focus on the pure logic of programs, to begin
to think about objects, which constitutes the basis of this paradigm. This is vital for the
development of large systems, since, instead of thinking
Information Systems
Page 55
In functions, we think about the relationships or interactions of the different components of the
system.
A class is a template. It defines in a generic way what objects of a certain type will be like. For
example, a class to represent animals can be called 'animal' and have a series of attributes, such as
'name' or 'age' (which are usually properties), and a series of behaviors that they can have, such as
walking or eating, and which in turn are implemented as methods of the class (functions).
A simple example of an object, as we said before, could be an animal. An animal has an age, so we
create a new attribute 'age', and it can age, so we define a new method. Data and logic. This is
what is defined in many programs as the definition of a class, which is the global and generic
definition of many objects. With the class you can create instances of an object, each of them with
its attributes defined independently. With this we could create a cat called Paco, 3 years old, and
another animal, this one a dog and called Pancho, 4 years old. Both are defined by class
animal, but they are
ANIMAL
two different
instances. Therefore,
calling its methods can
have results CLASSES
Information Systems
Page 56
4 principles of Object Oriented Programming
1 .- Encapsulation
Encapsulation contains all the important information of an object within the object and only
exposes selected information to the outside world.
2 .- Abstraction
3 .- The inheritance
4 .- Polymorphism
Information Systems
Page 57
Benefits of Object Oriented Programming
✓ Code reuse.
Page 58
Information Systems
Activity 4: Conceptual map of “Programming Methodologies
Instructions: Individually, make a conceptual map, according to the previous reading. You
can include images in your map. You can use digital tools to create your map (GoConqr,
canva,
midmaster, etc.).
Page 59
Information Systems
Assessment Instrument CHECKLIST
Activity 4 “Conceptual map,” Programming methodology”
GENERAL DATA
Name(s) of student(s) Registration number(s):
Product: Conceptual map Date:
Subject: Period:
Name of teacher: Teacher's signature:
Information Systems
Page 60
CO BATA B
TABASCO HIGH SCHOOL
TABASCO
'Education that generates
change'
Reference
Page 61
Information Systems
Reading 5. Programming using a high-level
language.
Python is a very powerful and flexible general-purpose programming language, while being simple
and easy to learn. It is a high-level language that allows easy processing of all types of data
structures, both numeric and text.
This language was created by Guido Van Rossum, beginning its development in 1989 and starting to
be implemented in February 1991, when the first public version was published: 0.9.0. Version 1.0
was released in January 1994, version 2.0 was released in October 2000, and version 3.0 was
released in December 2008. Python is developed under an OSI-approved open source license, so it
can be freely used and distributed, even for commercial use. The Python license is managed by the
Python Software Foundation.
Page 62
Information Systems
• In Python, the format of code (p. e.g. indentation) is structural.
Python files have the extension .py. They are text files that are interpreted by the compiler. In
order to run programs in Python, you first need the Python interpreter, and secondly the code
you want to execute.
4. Then select the Customize installation option and you will see the screen like the following:
5. You can then enable or disable the optional Python features and click Next.
Page 63
Information Systems
6. In the next window you will see some additional options and you must activate the box
Install for all users and this will change the path where Python is installed on the system.
7. Then click on Install to carry out the installation process of Python 3.9 on Windows 10.
8. Once this process comes to an end we will see the following. We click on Close to
exit the wizard.
Installation of Mu
Mu is an open source editor that seeks to make it easier for students to learn to code with Python, it
is a creation of Nicholas Tollervey, it is an open source application (licensed under GNU GPLv3)
written in Python. It was originally developed to work with the Micro bit minicomputer. Feedback
and requests from other educators prompted its creator to rewrite Mu as a generic Python editor.
Page 64
Information Systems
CO BATA B
TABASCO HIGH SCHOOL
'Education that generates change'
If you are a Windows user, you can install Mu Editor with a .exe installer as follows:
1. Go to https://codewith.mu/en/download
2. Download the Windows installer that corresponds to your processor architecture.
3. Open it and accept the security notice.
4. Complete the steps in the installer and click install.
TABASCO
5.2. Variables
A variable is a place that stores certain information. Depending on the type of information we store
(text, numbers, boolean, etc.), the variable will be of one type or another, that is, they are defined
dynamically.
Each variable must have a name with which we can refer to it.
• Python takes into account whether we write the variable in upper or lower case (case
sensitive).
• Variable name cannot match python "command" names
(if, for, etc.).
Variable names cannot be used with tildes or ñ.
Page 65
Information Systems
Examples: # Assign to the variable<a2> # Assign to the variable<a3>
# Assign to the variable<a1> the result of the expression the character string
the value 1 3*4 'Pythonista'
a=1 a2 = 3 * 4 a3 = 'Pythonist'
1 a=1
2 a2 =3*4
3 a3 = 'python sta'
4 print (a)
5 print (a2)
6 print (a3)
7 print("This is a text")
8
Page 66
Information Systems
If you want Python to interpret the input as an integer, you must use the int() function, to have
Python interpret the input as a decimal number, you must use the float() function. But if the user
does not enter a number, the int() or float() functions will throw an error.
age = int(input('Enter age: ')) # integer input weight = float(input('Enter weight: ')) #
float input name = input('Enter name: ') # string input print(name, age, 'years', weight,
'kg') # display data
Comments
They are character strings which constitute an essential aid both for the person developing the
program and for other people who read the code.
Page 67
Information Systems
They can be added in two ways:
• By typing the number character # in front of the line of text where the comment is.
• By writing triple double quotes (""") at the beginning and end of the comment (which can take
up more than one line).
Example:
i # This is a one line Python comment
2 print( "Example of a one-line comment")
4 .......
#4 After a statement
Numbers
Integers:
These are numbers that do not have decimals and can be positive and negative (0 is also an integer).
These numbers are known as int (integer) or long (long integer for more precision).
Examples: x = -4
y = 20
Information Systems
Examples: x = 3 + 6j
y = 5j
Page 68
Information Systems
Type of chains
Variables that store text are called strings (str). They must be between single (') or double («)
quotes, or if the text spans several lines, between triple double quotes («»»).
Example
> >> # We define two variables called text > >> # We define a new variable text3 that
and
> >> # includes multiline text.
> >> # text2, and we will associate a text to
each one > >> text3="""Hello
Types of booleans
This is the type of variable that can only have True or False. They are values widely used in
conditions and loops.
A boolean variable can be declared as follows.
x = True
y = False
Page 69
Information Systems
5.3 Operators
Operators are special symbols that represent calculations, such as addition or multiplication, and the
values to which these operators are applied are called operands.
Arithmetic operators
Suppose variable a = 10 and variable b = 20, then:
% Module Divides the left operand by the right operand and returns b% a = 0
the remainder
** Exponent Performs exponential (power) calculations on operators a**b=10 to the
power 20
// Radix division: The division of the operands where the 9 // 2 = 4 and 9.0 //
result is the quotient in which the digits after the decimal 2.0 = 4.0, -11 // 3 = -
point are removed. But if one of the operands is negative, 4, -11.0 // 3 = -4.0
the result is zeroed, that is, it is rounded away from zero
(towards negative infinity) –
Page 70
Information Systems
Python Comparison Operators
These operators compare the values on either side of them and decide the relationship between
them. They are also called relational operators. Suppose variable a = 10 and variable b = 20, then:
<= If the value of the left operand is less than or equal to the
(a <= b) is true.
value of the right operand, the condition becomes true.
Information Systems
Page 71
and Logic And If both operands are true, then the condition
(a and b) are true.
becomes true.
logical OR (a or b) is true.
If either operand is nonzero, the condition is met.
5.4 Constants
A constant is a type of variable which cannot be changed, they are usually declared and assigned in a
module. Module means a new file containing variables, functions, etc; which is imported into the
main file. Within the module, constants are written in UPPERCASE letters and words are separated
with the underscore character _.
In Python, constants are written using capital letters separated by the _ symbol. Now, just like types,
some constants come built into the Python language. Below we specify each of them:
1. None: The type assigned with the constant none has a single value applicable to a single
object. Therefore, its value cannot be used in different situations.
2. NoteImplement: Like None, this constant has a single value and applies to a single object.
However, it has some rich numerical and comparison methods to indicate that it is not being
implemented relative to another type.
Information Systems
Page 72
CO BATA B
TABASCO HIGH SCHOOL
3. Ellipsis: This constant also has a single value applicable to a single object. Its presence
indicates that there is a syntax, usually enclosed in quotation marks.
4. False: Like true, this constant is of boolean type. It can only have two values, and this one,
as the name indicates, represents a false condition.
5. True: A boolean value that represents that a conditional expression or loop is true.
TABASCO
Page 73
Information Systems
CO BATA B
TABASCO HIGH SCHOOL
'Education that generates change'
Information Systems
Page 74
31. Raise – Used to create exceptions, what to do when an exception occurs, same as 'except'
and 'try'
32. Return – Used inside a function to exit and return a value.
33. Try – Used to create exceptions, what to do when an exception occurs, same as 'raise' and
'except'
34. While – Used to create loops.
35. With – Used to simplify exception handling
36. Yield – Used inside a function just like 'return', except 'yield' returns a generator.
Page 75
Information Systems
PRACTICE No. 1 My first program
Purpose: To get you to apply the basic knowledge for the creation of a
sequential program in a high-level programming language.
Knowledge:
Development:
1. Create a program in Python that allows you to print messages with the print() function
and input data with the input() function, adding comments
2. Note: If you do not have a digital device, do the exercise in your notebook.
Page 76
Information Systems
5. When you finish the code, save the file in your folder with the following structure:
Practica01, initials of your name, group and shift. Example: “Practica1_GEHMAM” are
the initials of your name, A is the group and M is the shift for Morning and V for
Afternoon. If you have completed it in your notebook, it will be delivered to your
teacher for review.
6. Then press the run button and verify that the output is correct.
7. CONCLUSIONS: At the end of the practice, in your own words answer the following questions
in your notebook:
questions:
Information Systems
Page 77
Where do I apply it in my daily and academic life?
Information Systems
Page 78
Assessment instrument CHECKLIST PRACTICE No. 1 My first program
GENERAL DATA
Name(s) of student(s) Registration(s)
Product: First program. Date
Subject: Period
Name of the teacher Teacher's signature
QUALIFICATION
Information Systems
Page 79
CO BATA B
TABASCO HIGH SCHOOL
TABASCO
'Education that generates
change'
References
Page 79
Information Systems
Instructions: Read the following text, underlining the main
ideas.
It is recommended to practice with each of the examples,
at the end complete the
suggested activity depending on your teacher's
instructions.
Conditionals are program structures that are executed depending on the result of a comparison.
Python 3 uses If, Else and Elif (More than two alternatives) as comparison structures that allow us
to execute a certain block of code, provided that one or more conditions are met.
It is very likely that in your daily activities you will face these conditions, and we can cite an
example, when you wake up you identify the day of the week, so we can assume that, if it is
Sunday, and you ask yourself the question, do I have to go to school today?, the conditional
integrated in this question will only lead us to two possible answers, Yes or No, given that we have
identified that it is Sunday, you can then deduce that the answer would be No.
In programming terms, a question determines a path to follow, so in order to structure it, Python
uses the If statement, where If is “if” followed by the condition.
The syntax of the if construct is as follows:
if condition:
Here are the orders that are executed if the condition is true and that can
occupy several lines
Information Systems
Page 80
Information Systems
The execution of this construction is as follows:
The condition is always evaluated.
If the result is True, the block of statements is executed.
If the result is False, the block of statements is not executed.
(mclibre, 2020)
FLOWCHART: IF STATEMENT
Page 81
Information Systems
The result will be:
If the variable dia were assigned something other than “Sunday”, as it has no other block than
al •
interface and no data is s
ent to or received from the Internet.
k*********kkkk*******
******************** k*******
Ln: 13/4
Page 82
Information Systems
6.2. - IF…Else statement:
In cases where it is necessary to have a second block for when the condition returns “False”, in
if condition:
Here are the orders that are executed if the condition is true
and that can occupy several lines
else:
and here are the orders that are executed if the condition is
false and can also occupy several lines
The execution of this construction is as follows:
Page 83
Information Systems
Example:
Mu1.1.0.beta.5-conditionO.py — □X
i dia="saturday"#assign value 2 if dia=="sunday" :#verify that it is ''sunday" 3 print ('I'm not going to school
condidonl.py X condicion2mayor.py X condidionO.py X
Running: conditionO.pv
I go to classes
Python 3
Information Systems
Page 84
Source: Gonzalez (2009)
The if ... elif ... else ... control structure allows you to chain multiple conditions together. elif is a
contraction of else if. The command in Python is written like this:
if condition_1:
Block 1
elif condition_2:
Block 2
else:
Block 3
Page 85
Information Systems
if condition_1:
Block 1
else:
if condition_2:
Block 2
else:
Block 3
You can write as many elif blocks as you need. The else block (which is optional) is executed if none
of the above conditions are met.
Example: IF we modify the previous example and request the day of the week, considering that
there are Saturday classes and only Sunday classes are not held, using the elif function we will have
the following:
Page 86
Information Systems
For example, if the value “Tuesday” is captured, the execution will give:
Information Systems
Page 87
Knowledge:
✓ If Elif Else
✓ Variables
✓ Input()
✓ Print()
✓ Operators
Development:
1. Create a program in Python to calculate the largest of 3 integers.
Note: If you do not have a digital device, do the exercise in your notebook.
2. Open the programming editor suggested by your teacher.
3. Write the program code with the support of your classroom teacher.
4. When you finish the code, save the file in your folder with the following structure:
Practica02, initials of your name, group and shift. Example: “Practica02_KCGLAM”
are the initials of your name, A is the group and M is the shift for Morning and V is
the shift for Afternoon. If you have completed it in your notebook, it will be
delivered to your teacher for review.
5. Next, we run the program, press the run button and take a screenshot of your
results.
6. CONCLUSIONS: At the end of the practice, in your own words answer the following
questions in your notebook: What did I learn? What are the advantages of using If
Elif Else? Where do I apply it in my daily and academic life?
Information Systems
Page 88
Evaluation instrument CHECKLIST PRACTICE No. 2 - the greatest of all
GENERAL DATA
Name(s) of student(s) Registration(s)
Product: if elif else program Date
Subject: Period
Name of the teacher Teacher's signature
QUALIFICATION
Page 89
Information Systems
References
CO BATA B
TABASCO HIGH SCHOOL
TABASCO
'Education that generates
change'
Information Systems
Page 90
Information Systems
Reading 7. Repetitive Structures
Instructions: Read the following, underlining the main ideas. When you finish, do
practice No. 3
The Repetitive control structure, also known as loops or cyclic, allows us to execute a certain block
of code repeatedly, as long as a condition is met.
Python has two cyclic structures:
The While statement is used to repeat blocks of code “while” a certain condition is met.
Structure of WHILE:
1. while<CONDICIÓN> :
2. <CÓDIGO A EJECUTAR>
Example1-B While, py X
i # ICT Training
2 x = 0 fWe declare the value of the variable "x"
3 while (x < 10): #Create the loop with the condition to run while "x"
4sea less than "10"
5 x +=1 #Body of the repetition = we add one to x (x is equal to x plus one) and print (x) We print "x"
Page 91
Python 3
Information Systems
Result:
While Infinite
It is a While followed by a “True” (While True) that indicates that the condition will always be met.
The purpose is that the user cannot exit the loop and it does not end, until he enters a number and
chooses an option to obtain a result.
Break
This instruction is used to end a loop. That is, exit it and continue with the execution of the rest of
the program instructions and this can be used for While and For.
Page 92
Information Systems
Example 2: Create a breakfast menu using infinite repetition (While True) and when choosing an
option, execute the option, exit the option (break) and then continue the program instructions.
Ejem2-BWhileInfinito.py X
i # ICT Training
6
elif option == '3':
7 print ("Consists of 2 eggs, sausage, pancakes, coffee or tea and juice")
s break #We break the loop
9 else:
10 | print ("You must select an option (1, 2 or 3)")
11 print("Order Received, enjoy your breakfast...") #We add a print OUTSIDE THE LOOP to end
12
Note: The variable “option” is of text type, the while loop requests to choose an option from
13
14
menu 1, 2 or 3, otherwise if you type another number or letter, it will repeat the menu until
15
16
you choose the correct option. The if conditions are between '1' apostrophes because they are
17
18
text type, you can also use “1” quotation marks.
19
20
Information Systems
Page 93
Result:
The FOR statement is used to repeat a block of code, but unlike the WHILE statement where it
depends on a condition (TRUE, FALSE), the FOR loop ends when it has no more elements to iterate
through.
FOR structure:
1. FOR<elemento> IN<elementos a iterar> :
2. <CÓDIGO A EJECUTAR>
Example 1: Create 3 lists. List from 0 to 5, List between 10 to 20 and List of multiples from 5 to 50
and a list that uses the character length of a text string and the variable goes through taking each
value.
Page 94
Information Systems
Result
Page 95
Information Systems
PRACTICE 3 -Calculate the average of 3 grades
professionals.
Knowledge:
✓ For Structure
✓ Loop control
✓ While Structure
✓ Break
✓ Infinite While Structure
✓ Conditions
DEVELOPMENT
8. Create a program in Python to calculate the average of 3 grades.
Note: If you do not have a digital device, do the exercise in your notebook.
9. Open the programming editor suggested by your teacher.
10. Write the program code with the support of your classroom teacher.
With the repetitive structure: WHILE
Information Systems
Page 96
Information Systems
With the repetitive structure: FOR
11. When you finish the code, save the file in your folder with the following structure: Practica03, initials of
your name, group and shift. Example: “Practica03_KCGLAM” are the initials of your name, A is the
group and M is the shift for Morning and V is the shift for Afternoon. If you have completed it in your
notebook, it will be delivered to your teacher for review.
12. Next, we run the program, press the run button.
Example:
Information Systems
Page 97
COBATAB
TABASCO HIGH SCHOOL
TABASCO
“Education that generates
change”
13. CONCLUSIONS: At the end of the practice, in your own words answer the following questions in your
notebook: What did I learn? What are the advantages of using the For and While cycles? Where do I
apply it in my daily and academic life?
Page 98
Information Systems
CO BATA B
TABASCO TABASCO HIGH SCHOOL
GENERAL DATA
Name(s) of student(s) Registration(s)
Date
Product: Repetitive structure program (FOR or WHILE)
Subject: Period
Name of the teacher Teacher's signature
QUALIFICATION
04
Information Systems
Page 99
CO BATA B
TABASCO HIGH SCHOOL
TABASCO
'Education that generates
change'
References
Page 100
Information Systems
Ib—
Reading 8 Lists and
Instructions: Read the following, analyze the structures for treating lists, and when you
finish, do practice 4.
Among the many types of data structures that Python has, lists are one of the most used, since they are
very versatile as they allow storing data regardless of its type; Moya, R. (2015) defines lists as:
They are a very flexible type of data structure that stores in an orderly manner a set of data that
does not have to be of the same type. In other programming languages a list would be equivalent
to an array, although Python does not require that the elements of the list have to be of the same
type ('int', 'float', 'chr', 'str', 'bool', etc.').
So we can say that a list is an array of elements in which we can have integers, floats, text strings, booleans,
and even other lists within it. To create a list we only have to give it a name (like any variable), place each of
its elements in brackets and separated by commas.
Figure 1 Creating lists in python3
masuaa-mamsmma r)(+)(2)(±)(•)(*)()()()(C • ? b New Mode Download Save Run Debug REPL Zoom In Zoom
Out Topic Check Help Exit 207 X 1p X creocondelistayopoonespy X Cresrlotapy X sndodo* X 1 Creating a list 2
3 list=[10,8.5,"python3",[1,2,"list"],"etc"]
Note: within the list there are different types of data, from left to right: int, float, str, list, str.
4 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- praying
Information Systems
Page 101
Although we can create a list with all the information we could use (see figure 1), it is also possible to create
a blank list and, using the input function and some methods used in lists, add the data we need.
Accessing and viewing the contents of a list is easy, using the print function either to see the entire content,
or a specific item.
Note: The print(list name) function sends all the elements contained in the list to be displayed on the screen.
Figure 3 Displaying specific items in a list
Note: with the print(list name [element index]) function, a specific element is sent to be displayed.
Page 102
Information Systems
Within the lists, the indexes of the elements start at 0, so the first element within this will have this index,
the second index 1, the third index 2, etc.
Another way to access and display all the elements found within the list is by using the for loop.
Note: with for we can go through all the elements of the list and then display them with print, in this case the elements
are shown in a descending list.
In order to work with lists, Python has specific methods, some of them similar to those used with str text
strings. These methods will allow us to add data, delete it, know its indexes, count repetitions, invert them,
etc. Python Software Foundation (2021a). There are eleven methods for working with lists in Python3, but
we will only work with the most commonly used ones.
Information Systems
Page 103
Table 1
Most used methods for working with lists in Python3
message.
Note: Own creation. Based on: Python Software Foundation (2021b), Mariños, J.(sf), Gónzalez,
R.(2011).
Page 104
Information Systems
Below are examples of the methods listed in Table 1, for these examples the list “names” will be used:
Figure
6
Note: The elements "Armando" and "Manuel" are added at the end.
Information Systems
Page 105
Figure 7 .remove method
Note: The element being removed is within the .remove parameter, in this case it is
"pedro".
Note: All elements of the list are removed, however, the list still exists and when
viewed with print the empty brackets appear.
Information Systems
Page 106
Figure 9 .index method
Note: Returns the index value of the indicated element, in this case the element "juan" is
located at index 1.
Note: Returns the number of times an element is repeated, in this case the element "juan" is
repeated 2 times.
Information Systems
Page 107
Figure 11 .reverse method
Now that you know what lists are and the most commonly used methods for working with them,
let's put this new knowledge into practice.
Example 1
We will create a blank list (it is recommended that the name of the list refers to the elements it
contains) and through the .append method we will enter elements into it. It is necessary to create
a variable so that with this and the input function we can enter the elements of our list using the
keyboard.
Information Systems
Page 108
Figure 12 Creating an empty list, variable for data entry and using the .append method.
Note: the elements entered into the list are displayed using the print function.
Now, using loops we could enter a certain number of elements; if we want to determine how many
elements we want to enter before displaying our list we can use the for a loop as shown below:
Figure 12 Creating an empty list, variable to determine the number of elements we want to enter
and using the for loop.
From this example you can create a program in which you manipulate a list with the different
methods and loops that you have worked on throughout the submodule.
Information Systems
Page 109
CO BATA B
TABASCO HIGH SCHOOL
TABASCO
'Education that generates
change'
Arrangements
The data structures we have seen so far (lists) allow us to manipulate data in a very flexible way. By
combining and nesting them, it is possible to organize information in a structured way to represent
real-world systems.
In many engineering applications, on the other hand, more important than the organization of data
is the ability to do many operations at once on large sets of numerical data efficiently. Some
examples of problems that require manipulating large sequences of numbers are: weather
prediction, building construction, and financial indicator analysis among many others.
The data structure used to store these large sequences of numbers (usually of float type) is the
array.
Arrays are the programming equivalent of matrices and vectors in mathematics. Precisely, a big
motivation for using arrays is that there is a lot of theory behind them that
Page 110
Information Systems
can be used in the design of algorithms to solve truly interesting problems.
Create arrangements
The module that provides the data structures and functions for working with arrays is called
NumPy, and is not included with Python, so it must be installed separately.
Download the appropriate installer for your version of Python from the NumPy downloads page.
To see what version of Python you have installed, look at the first line that appears when you open
a console.
To use the functions provided by NumPy, we must import them at the beginning of the program:
The data type of arrays is called array. To create a new array, you can use the array function
passing it as a parameter the list of values you want to add to the array:
Information Systems r
Page 111
>>> b = array([6.0, 1, 3, 9, 8])
> >> b
array([ 6., 1., 3., 9., 8.])
Another option is to convert the array to another type using the astype method:
> >> a
array([6, 1, 3, 9, 8])
> >> a.astype(float)
array([ 6., 1., 3., 9., 8.])
> >> a.astype(complex)
array([ 6.+0.j, 1.+0.j, 3.+0.j, 9.+0.j, 8.+0.j])
If you want to know more about the treatment of arrangements, we provide you
with the following QR or open the following URL:
http://progra.usm.cl/apunte/materia/arreglos.html
Information Systems
Page 112
Information Systems
Practice 4 List manipulation
Knowledge: lists, methods for list manipulation, while and for loops, if, elif, else conditional statements,
break statement.
Instructions:
1. Take the reading example as a basis.
2. Modify the program by adding loops and conditional statements
3. Consider that the program takes an empty list as a base, it should ask for the number of
elements that we want to enter, show the list and ask if we want to enter another element.
4. You must request the removal of at least one item
5. You should have the option to exit the program.
Consider that the solution depends largely on the use of each sentence seen, the application of these
depends on your reasoning ability and your creativity.
Information Systems
Page 113
Information Systems
Assessment Instrument CHECKLIST Practice 4 “List manipulation”
GENERAL DATA
Name(s) of student(s) Registration(s)
Product: Practice 4 Date
Subject: Period
Name of the teacher Teacher's signature
QUALIFICATION
Information Systems
Page 114
CO BATA B
TABASCO HIGH SCHOOL
TABASCO
'Education that generates
change'
References:
Python Software Foundation (2021). More about lists. Data structure. Documentation.
https://docs.python.org/es/3/tutorial/datastructures.html#more-on-lists
Page 115
Information Systems
Systems Development
Student Teaching Guide
Python 3 has the functionality to create graphical interfaces (GUI), for this it
uses libraries, the easiest one that comes preloaded in the installer, and that is
multiplatform is Tkinter (tk). Labels and their use require a bit more
specialization, as an example, and to familiarize you with them we present the
creation of a window using this library.
Suarez and Suarez (2015) present us with the following basic example.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
root = Tk()
root.title('Application')
Block name
Page 117
Systems Development
Student Teaching Guide
root.mainloop()
You can learn more about graphical interfaces at the following link:
https://python-para-impacientes.blogspot.com/2015/12/
tkinter-interfaces-graficas-en-python-i.html
or at: https://www.youtube.com/watch?v=Nn0AVbGVMhk
Block name
Page 118
Systems Development
Student Teaching Guide
Reference
Block name
Page 119