0% found this document useful (0 votes)
3 views9 pages

Module 1 Notes

The document outlines appropriate uses for automation, including tasks like traffic light regulation and data reporting, while also highlighting situations where human intervention is necessary, such as creative design and complex problem-solving. It provides an introduction to Python, emphasizing its versatility, ease of use, and relevance in IT for automation and data analysis. Additionally, it covers programming concepts, common errors, and tools for writing and executing Python code.

Uploaded by

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

Module 1 Notes

The document outlines appropriate uses for automation, including tasks like traffic light regulation and data reporting, while also highlighting situations where human intervention is necessary, such as creative design and complex problem-solving. It provides an introduction to Python, emphasizing its versatility, ease of use, and relevance in IT for automation and data analysis. Additionally, it covers programming concepts, common errors, and tools for writing and executing Python code.

Uploaded by

Nighat Iqbal
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Appropriate uses for automation include:

 The automatic timing and regulation of traffic lights

 A repetitive task that is at high risk for human error

 Sending commands to a computer

 Detecting and removing duplicates of data

 Sending automated emails that are personalized by pulling individual names from a database
and plugging them into the email

 Updating a large number of file permissions

 Reporting on system data, like disk or memory usage

 Installing software

 Generating reports

 Deploying a file or a computer program to all computers on a company network

 Using a configuration management system to deploy software patches, after a human has
designed the system

 Populating an e-commerce site with products

 Setting the home directory and access permissions for users

Automation is not always an appropriate or complete solution

 Items that require human evaluation and analytic skills:

o Designing a configuration management system

o Investigating and troubleshooting all end user problems

o Writing a computer program

o Building a new startup business

 Items that require human creativity and/or an eye for aesthetic qualities:

o Designing an attractive webpage (AI can do this, but simple automation cannot)

o Wedding photography

o Haircuts and styling

 Items that cannot be automated due to basic physics:

o Troubleshooting or repairing machines that cannot power on or boot up

 Items that need human interaction, psychology, and/or evaluation skills:

o Interviewing and hiring new employees

o Customer service (chat bots cannot address every customer service need)

 Items that should not be fully automated due to costs and safety:
o Grocery store checkout process, including bagging groceries

o Tasks that are less expensive to perform manually

Key Terms used in Programming

 Programming code - Programming code is a set of written computer instructions, guided by


rules, using a computer programming language. It might help to think of the computer
instructions as a detailed, step-by-step recipe for performing tasks. The instructions tell
computers and machines how to perform an action. Programming code may also be referred
to as source code or scripts.

 Programming languages - Programming languages are similar to human spoken languages in


that they both use syntax and semantics. Programming languages are used to write
computer programs. Some common programming languages include Python, Java, C, C++,
C#, and R.

 Syntax - Syntax is a set of rules for how statements are constructed in both human and
computer languages. Programming syntax includes rules for the order of elements in
programming instructions, as well as the use of special characters and their placements in
statements. This concept is similar to the syntax rules for grammar and punctuation in
human language.

 Semantics - Semantics refers to the intended meaning or effect of statements, or collections


of words, in both human and computer languages. Semantic errors are also referred to as
logical errors.

 Computer program - A computer program is a step-by-step list of instructions that a


computer follows to reach an intended goal. It is important to be clear and precise about the
actions a computer program is supposed to perform because computers will do exactly what
they are instructed to do. Computer programs can be long, complex, and accomplish a
variety of tasks. They are often developed by computer programmers and software
engineers, but anyone can learn to create them. Computer programs may involve a
structured development cycle. They can be written in a wide variety of programming
languages, such as Python, Java, C++, R, and more. The completed format of a program is
often a single executable file.

 Script - Scripts are usually shorter and less complex than computer programs. Scripts are
often used to automate specific tasks. However, they can be used for complex tasks if
needed. Scripts are often written by IT professionals, but anyone can learn to write scripts.
Scripts have a shorter, less structured development cycle as compared to the development of
complex computer programs and software. Scripts can be written in a variety of
programming languages, like Python, Javascript, Ruby, Bash, and more. Some scripting
languages are interpreted languages and are only compatible with certain platforms.

 Automation - Automation is used to replace a repetitive manual step with one that happens
automatically.

 Output - Output is the end result of a task performed by a function or computer program.
Output can include a single value, a report, entries into a database, and more.

 Input - Input is information that is provided to a program by the end user. Input can be text,
voice, images, biometrics, and more.
 Functions - A function is a reusable block of code that performs a specific task.

 Variables - Variables are used to temporarily store changeable values in programming code.

Below, you’ll find links to some of the most popular online interpreters and codepads. Give
them a go to find your favorite.

 [Link]

 [Link]

 [Link]

 [Link]

 [Link]

 [Link]

Common syntax errors:

 Misspellings

 Incorrect indentations

 Missing or incorrect key characters:

o Bracket types - ( curved ), [ square ], { curly }

o Quote types - "straight-double" or 'straight-single', “curly-double” or ‘curly-single’

o Block introduction characters, like colons - :

 Data type mismatches

 Missing, incorrectly used, or misplaced Python reserved words

 Using the wrong case (uppercase/lowercase) - Python is a case-sensitive language

Common semantic errors:

 Creating functional code, but getting unintentional output

 Poor logic structures in the design of the code

Why is Python relevant to IT?:

 Widely Used: Python is one of the most popular programming languages in the IT industry
today.

 Versatility: You can use Python for a huge variety of tasks, from automating simple tasks to
complex areas like machine learning and data analysis.

 Automation Powerhouse: Python is a top choice for IT support, system administration, and
web development because it excels at automating everyday tasks.
 Growing Field Applications: Fields like machine learning and data analytics, which are
experiencing rapid growth, often rely heavily on Python.

 Accessibility and Support: Python runs on various operating systems and has a large,
supportive community, making it easier to learn and find help when you need it.

Topic: Introduction to Python

Key Takeaways:

 What is Python?

o General-purpose programming language.

o Used for scripting, automation, and application development.

o Beginner-friendly due to its readable syntax.

 Python's Compatibility:

o Works on various operating systems (Windows, Linux, Mac OS).

o Runs on diverse devices (servers, PCs, mobile devices, etc.).

 Python in IT:

o Widely used in IT support, system administration, web development, data science,


and more.

 Python vs. Other Languages:

o Easier to learn than some due to its English-like syntax.

o Different from platform-specific scripting languages (e.g., PowerShell, Bash) and


client-side languages (e.g., JavaScript).

 Important Concepts:

o Cross-platform language: Compatible with multiple operating systems.

o Python interpreter: Executes Python code by translating it into computer


instructions.

Example: Python vs. Bash

 Python: `

Print to screen in Python Print to screen in Bash

>> print("Hello, how are you?") >> echo Hello, how are you?

Hello, how are you? Hello, how are you?

Getting Information from the User


 Why: Programs need user input to be useful. It allows them to perform actions tailored to
the user's needs.

 How:

o Websites: Text fields, links, buttons, drop-down menus.

o Mobile Apps: Buttons, selections, touch input.

o Command-Line Programs: Parameters passed in the command, interactive prompts.

 Data Sources:

o Files (e.g., a list of emails in a file).

o Other sources gathered and processed in the background.

 Simple Example (Python):

name = "Your Name"

print("Hello,", name + "!")

 Key Point: Separating data (like the name) from the code that uses it makes the code more
flexible and reusable.

Functions

A function is a piece of code that performs a unit of work. In the examples you've seen so far, you
have only encountered the print() function, which outputs a message to the screen.

Keywords

A keyword is a reserved word in a programming language that performs a specific purpose. In your
first Python example, you briefly encountered the keywords for and in. Note that keywords will often
appear in bold in this course.

In the next few weeks, you will also learn the following keywords:

Values: True, False, None

Conditions: if, elif, else

Logical operators: and, or, not

Loops: for, in, while, break, continue

Functions: def, return

Arithmetic operators

Python can calculate numbers using common mathematical operators, along with some special
operators, too:

x+y Addition + operator returns the sum of x plus y

x-y Subtraction - operator returns the difference of x minus y

x*y Multiplication * operator returns the product of x times y


x/y Division / operator returns the quotient of x divided by y

x**y Exponent ** operator returns the result of raising x to the power of y

x**2 Square expression returns x squared

x**3 Cube expression returns x cubed

x**(1/2) Square root (½) or (0.5) fractional exponent operator returns the square root of x

x // y Floor division operator returns the integer part of the integer division of x by y

x%y Modulo operator returns the remainder part of the integer division of x by y

Order of operations

The order of operations are to be calculated from left to right in the following order:

1. Parentheses ( ), { }, [ ]

2. Exponents xy (x**y)

3. Multiplication * and Division /

4. Addition + and Subtraction -

Resources for more information

For more information about the concepts covered in this reading, please visit:

 Built-in Functions - Lists and summarizes Python’s built-in functions.

 Python Keywords - Lists Python’s reserved keywords and a brief description of what each
keyword does.

 Different Arithmetic operators in Python - Provides more examples of the proper syntax for
using arithmetic operators in Python.

Code Editors

 Purpose: Make writing code easier.

 Features:

o Syntax highlighting (colors code for readability)

o Automatic indentation (keeps code organized)

o Error checking (helps find mistakes)

o Auto-completion (suggests code while you type)

 Examples: VS Code, Jupyter Notebooks, CoLab

 Analogy: Like a landline phone - focused on one task.

IDEs (Integrated Development Environments)

 Purpose: Provide a complete environment for software development.


 Features:

o Include all the features of a code editor.

o Tools for building, testing, and packaging applications.

o Streamline the development process.

 Examples: IDLE (comes with Python)

 Analogy: Like a smartphone - offers many additional features.

Key Differences:

 IDEs offer more features and tools than code editors.

 Code editors are simpler and focus on writing code.

 IDEs provide a more comprehensive development experience.

 Command-Line Basics:
o The command-line is a powerful tool for interacting with your computer.
o You can use it to run programs, navigate files and folders, and write scripts.
 Python and the Command-Line:
o You can run Python scripts directly from the command-line.
o This is done by typing "python" followed by the name of your script file.
 Accessing the Command-Line:
o MacOS: Use Spotlight search to find and open the "Terminal" application.
o Windows: Search for "cmd" in the Start menu and run it as administrator.
o Linux: Use the keyboard shortcut Ctrl+Alt+T to open the terminal.
 Python IDLE:
o IDLE is a beginner-friendly Python editor that comes bundled with Python.
o It offers syntax highlighting, code completion, and a built-in Python interpreter.
 Python Script Execution:
o You can write Python code in a plain text file and save it with a ".py" extension.
o To run the script, use the command "python your_script_name.py" in the command-
line.

Command Line Basics

 Purpose: The command line is a powerful tool for interacting directly with your computer. You
can use it to run programs, navigate folders, and much more.
 Accessing the Terminal (Linux):
o Click the terminal icon.
o Use the keyboard shortcut: CTRL + ALT + T

Python and the Command Line

 Checking for Python: Most Linux systems come with Python pre-installed. Type python in the
terminal to check.
 Installing Python (if needed):
o Use the command: sudo apt install python3
o You'll need to enter your password.
 Interactive Mode:
o Start interactive mode by typing: python3
o Try a simple command like: print("Hello World!")
o Exit interactive mode: exit()

Introducing IDLE

 What is IDLE? IDLE stands for Integrated Development and Learning Environment. It's a user-
friendly way to write and run Python code.
 Key Features:
o Syntax Highlighting: Makes your code easier to read.
o Code Completion: Helps you write code faster.
o Automatic Indentation: Ensures your code is formatted correctly.
 Installing IDLE (Linux):
o Use the command: sudo apt install idle
 Running IDLE:
o Type idle in the terminal.

Writing and Running a Python File in IDLE

1. Write Your Code: Type your Python code in the IDLE window.
2. Save Your File: Go to "File" > "Save As..." and give your file a name (e.g., my_program.py).
3. Run Your Code:
o Go to "Run" > "Run Module".
o Press the F5 key.

Popular Python Tools: PyCharm, PyDev, and Notepad++ are popular choices for writing Python
code.

PyCharm: Beginner-friendly with a large community, offers features like code completion and a
debugger.

PyDev: Open source, based on Eclipse, good for refactoring and integrates with Eclipse features.

Notepad++: A solid text editor for Windows users, supports syntax highlighting and has a
collaborative community.

Glossary terms from course 1, module 1

Terms and definitions from Course 1, Module 1

Automation: The process of replacing a manual step with one that happens automatically

Client-side scripting language: Primarily for web programming; the scripts are transferred from
a web server to the end-user’s internet browser, then executed in the browser

Code editors: Tools to provide features, including syntax highlighting, automatic indentation,
error checking, and autocompletion

Computer program: A step-by-step list of instructions that a computer follows to reach an


intended goal
Functions: A reusable block of code that performs a specific task

IDE: A software application that provides comprehensive facilities for software development

Interpreter: The program that reads and executes code

Input: Information that is provided to a program by the end user

Logic errors: Errors in code that prevent it from running correctly

Machine language: Lowest-level computer language. It communicates directly with computing


machines in binary code (ones and zeros)

Object-oriented programming language: Most coding elements are considered to be objects


with configurable properties

Output: the end result of a task performed by a function or computer program

Platform-specific scripting language: Language used by system administrators on those specific


platforms

Programming: The process of writing a program to behave in different ways

Programming code: A set of written computer instructions, guided by rules, using a computer
programming language

Programming languages: Language with syntax and semantics to write computer programs

Python: A general purpose programming language

Python interpreter: Program that reads and executes Python code by translating Python code
into computer instructions

Script: Often used to automate specific tasks

Semantics: The intended meaning or effect of statements, or collections of words, in both


human and computer languages

Syntax: The rules for how each statements are constructed in both human and computer
languages

Variables: These are used to temporarily store changeable values in programming code

You might also like