Skip to content

In this module we’ll introduce you to the Coursera platform and the course format. Then, we’ll dive into the basics of programming languages and syntax, as well as automation using scripting. We’ll also introduce you to the Python programming language and some of the benefits it offers. Last up, we’ll cover some basic functions and keywords of the language, along with some arithmetic operations.

Learning Objectives

  • Define the terms computer program, programming language, script, and automation
  • Use the print() function to output data to the screen
  • Explain the difference between the syntax and semantics of a programming language
  • Define automation and identify uses for automation
  • List some of the characteristics of the Python language
  • Utilize basic Python arithmetic operators to obtain the results of mathematical expressions

Course Introduction


Video: Specialization Introduction

This program is designed to teach you how to code in Python, with a focus on how to use it to automate tasks in IT systems support and administration. It is geared towards people who are already in or aspiring to be in the field of IT.

The program will teach you the basics of Python programming, as well as how to use it to interact with the operating system, manage code versions with Git and GitHub, troubleshoot and debug problems, and automate tasks at scale.

The program is taught by a team of Google engineers who have all started their careers in IT support and then learned programming to move onto more technical roles.

The program includes three hands-on methods of teaching coding and Python and automation: code blocks, Jupyter notebooks, and Qwiklabs.

At the end of the program, you will complete a final project designed to solve tasks that you might encounter in real-world IT settings. You can post your projects to GitHub to show off your new skills to employers or friends.

Working in IT is more
than just a job. It’s a career path. Research shows that the
field of IT support is a launchpad for future career
growth and better wages. In fact, a study on the subject
was recently conducted by the Harvard Business
School Accenture and Burning Glass entitled
Bridge the Gap. It found that among today’s
middle-skilled jobs which require training but not
a formal college degree, IT support offers clear
pathways to prosperity. We saw this phenomenon
play out here at Google, in our IT support program. Those who push themselves
to learn how to code in Python typically saw
strong career growth. They built skills
that are critical to accessing higher level
positions in the IT field, and after honing those skills through hard work
and determination, they advanced into more technical
IT support specialists, systems administrators,
technical solutions engineers, and even site
reliability engineers. The common thread across
all of these roles is knowing how to
write code to solve problems and automate solutions. By expanding your toolbox
to include coding skills, you open a window into the
world of systems management that can lead you towards more advanced technical
roles down the line. Python in particular is
having a huge resurgence. According to the 2019 Stack
Overflow Developer Survey, Python is the coding language
most people want to learn. The second most loved
by those who already know it and the fourth
most popular overall. So why take this program to
learn how to code in Python? Well, first it’s geared
towards people who are already in or aspiring to
be in the field of IT. Maybe you’re thinking bigger
about your current IT role and want to work towards
managing operations at scale, or maybe you’re just
starting out and looking to break into
the IT industry. Perhaps you’ve taken our IT Support Professional
Certificate program on Coursera already, or you have equivalent IT support knowledge with basic
computing skills, like working with
files and directories, familiarity with
networking concepts, and understanding how to install software on your computer. In any case, this program
is tailor-made for you. Second, this program offers three hands-on methods
of teaching coding and Python and automation, code blocks, Jupyter
notebooks, and Qwiklabs. Third, we’ve assembled
an awesome group of Googlers who will serve as your instructors in each course. They all started their careers
in IT support then learned programming and moved onto
more technical roles like me. We can’t wait to share
our stories with you on how we use Python
in our day-to-day. Oh and hey, I should
probably introduce myself. My name is Christine Rafla, and I’m a Systems
Administrator at Google. I will be your instructor
in this course. This program has been entirely designed and
developed by Google and we even filmed each course at different cool Google spaces. It will introduce you to the Python programming
language with a special focus on
how this language applies to automating
tasks in the world of IT systems support
and administration. I’m super excited to
be here with you. When I was younger, I had no idea that careers
in IT even existed. There are a lot of
reasons I wanted to participate in the
certificate program. But one of my biggest
motivations is that I want to see more women
represented in the industry. I remember going to a System Administration
Summit where there were hundreds of men and about three women
that were sysadmins. A lot has changed since then
but there’s still so much we can do to bring new ideas and representation into the IT field. That’s why I want to
share my knowledge with as many people as possible. I love my job and I love the
people I work with because they make it easy to ask for help and offer their guidance. This type of support
network allows our team and ultimately our industry
to be more successful. I understand from experience that it can feel
pretty intimidating and maybe even a bit scary
to learn a coding language. Just remember,
everyone started where you are right now with
the first command, the first script, and of course, the first of many errors. When I started out in my career, I strived to get everything perfectly right the
first time I tried it. But that actually slowed
down my progress. So don’t be afraid
to make mistakes, it will give you a leg up. So let’s get down to
it. What’s ahead? The program begins with a crash course in
Python where you will learn to write
simple programs and understand their
role in automation. Next, we’ll get
more hands-on focus on how Python interacts
with the operating system. After that, we’ll
cover how to use Git and GitHub to manage
versions of your code. Then we will focus on troubleshooting and
debugging techniques to find and solve the root cause of problems in IT infrastructure. The next course covers automating at scale
where you will learn to deploy configuration
management on a fleet of either physical or virtual
machines running in the Cloud. Last up, we will bring all this knowledge
together and complete a final project designed
to solve tasks that you might encounter in
real-world IT settings. Bonus, you can post your
projects to GitHub to show off your fancy new skills to
employers or friends or both. That was a lot to rattle off. Are you excited or what? Now I’d like to quickly
introduce you to my fellow instructors who you will get to
meet along the way. Hey, my name is Roger Martinez. I’m a Linux System Administrator, and I’ll be your instructor
in the course on using Python’s interacts
with operating system. Hi. I’m Kenny Sulma, and I’ll be your guide in
the course about using Git and GitHub to manage
versions of your code. Hi there. I’m Amanda Ballas, and I’ll be teaching you about troubleshooting and debugging. Hey, I’m Phelan Vendeville,
and in my course, we’ll learn about
Automation at scale using Configuration
Management and the Cloud. Thanks everyone. This all-star team
was brought together to guide you on your
adventures in coding. You’re in very good hands. Okay, I think that’s everything. Let’s get ready to
learn some new skills and maybe even have some
laughs along the way. I’ll see you in the next video.

Video: Course Introduction

This course will teach you the basics of programming in Python, with a focus on how to use it to automate tasks in IT roles. You will learn how to write simple programs, figure out how the building blocks of programming fit together, and combine all this knowledge to solve complex programming problems.

By the end of this course, you will be able to:

  • Write a program in Python that’s designed to solve a real-world IT problem
  • Understand the benefits of programming in IT roles
  • Be able to write simple programs using Python
  • Figure out how the building blocks of programming fit together
  • Combine all this knowledge to solve a complex programming problem

The course will start with the basics of writing a computer program and then cover more complex topics such as automation. The instructor will use interactive exercises and real-world examples to help you learn the material.

If you get stuck at any point, you are encouraged to re-watch the videos and practice as much as you like. The goal of the course is to introduce you to some of the key concepts of programming and scripting that will empower you to spot opportunities for automation in real life.

[MUSIC] If you work in IT, computer programming skills open up
an incredible amount of opportunity. Being able to write scripts and programs
that tell your computer to perform a task equips you with an invaluable tool. Not only does it make your work easier and
more efficient, it can help you grow faster and
advance further in your IT career. But how do you even start to learn
a programming language like Python? How do you recognize when to tell
a computer to perform a task? And how do you then write a program to actually get your computer complete
the task you want it to do? The thought of learning to write a program
in Python can make you feel a whole bunch of emotions excitement, anticipation that
feeling of wanting to dive right in and get going and also fear. You might ask yourself, can I really
learn how to code or do I have it in me? I’m here to tell you, yes,
you can absolutely do this. Learning how to program can be scary and
intimidating, but at the same time it’s really fun and
really exciting. In coding as in life, if we’re going to
get philosophical, the most rewarding work is usually a bit challenging,
but ultimately well worth the effort. Of course, I’m able to say all this from
experience, especially the cheesy parts. My name is Christine Rafla. I’m a systems administrator at Google and
I’m going to be your instructor and guide in this course. The role of a sysadmin can vary
a lot from company to company and even within different
teams in the same company. I happen to work in the corporate identity
and access management operations team, which is a really long way of saying
that we make sure that everyone is represented correctly and if they need
to access certain resources, they can. What I love the most about being
a sysadmin is that the role has so many diverse functions. We handle loads of unique problems and edge cases from tinkering with different
systems to collaborating with other teams. I am always learning something new,
so it’s really hard to get bored. It all starts with
knowing how to automate, if you’re an IT support specialist,
a systems administrator, or in a role somewhere in between knowing how to get
computers to do the hard work for you will set you apart from others in similar IT
roles and make your life much easier. Think about it, would you rather manually
deploy 100 computers on your own or tell your computer to do it all for
you all at once? No-brainer, right, having a coding
skill set can help you grow into more specialized roles like a systems
administrator, Cloud Solutions engineer, DevOps specialist,
site reliability engineer, or who knows maybe even web developer or
data analyst. The point is, being able to write a program is
an essential tool in your IT toolkit and more and more employers are looking for
these skills in the people they hire. If you’ve ever learned a new skill,
like playing a musical instrument, speaking a foreign language,
knitting, or skateboarding. You know that getting good at something
new requires a lot of practice. For me, I love to learn new languages and
I’m proud to say I speak Spanish, Arabic, French, and
I even know ten words in Russian. Our world is shaped by the words and
the languages we speak and while some words may be unique
to one language you can always find similarities that
help you learn and understand. Being able to connect the dots between
cultures allows me to see things others might not, kind of sounds like
this applies to IT programming, huh? My point is, whether you’re learning
French or Python, it’s never easy. You have to start small, learn the basics
and practice those until you master them. Only then can you move
on to more complex and impressive stuff and
I’m here to help you along that path along with my colleagues who
you’ll meet in later courses. We’ll start slow,
master the foundations together and you’ll soon be ready for
more challenging stuff. So are you wondering why we filmed this
course in a cabin on a lake in Canada. The truth is were actually in a game room
at one of the Google offices in Sunnyvale, California. We chose a different themed office space
for each course of the program just to mix things up and
I think I scored with this one. I should warn my manager that I’ll be
hanging out in this one well after the course ends because it’s super comfy. By the end of this course, you’ll understand the benefits
of programming in IT roles. You’ll be able to write
simple programs using Python, figure out how the building blocks
of programming fit together, and combine all this knowledge to solve
a complex programming problem. That’s right, by the end of this course,
you’re going to write a program in Python that’s designed to solve a real-world
IT problem, super exciting right? We’ll start off by diving into the basics
of writing a computer program. You’ll get hands-on experience with
programming concepts through interactive exercises and real-world examples. You’ll quickly start to see how computers
can perform a multitude of tasks. You just have to write code
that tells them what to do. Along the way, we’ll be talking about
automation, which is process of getting computers to automatically do a task that
us humans normally have to do by hand. Now, some of the stuff can get
a little complex and confusing. I promise to do my best to make these
lessons clear and easy to understand, but if you get stuck at any point,
please feel free to re-watch the videos. Practice as much as you like and take the time you really
need to understand these topics. The goal of this course isn’t to teach you
everything there is to know about software engineering because yikes,
that would be a long course. Instead, we’re going to introduce you to
some of the key concepts of programming and scripting that will empower
you to spot opportunities for automation in real life. You’re about to learn a skill that
can help you take your career to whole new levels. Are you excited? I’m excited, so let’s jump in!

Reading: Welcome to the Course!

Reading

Introduction to Programming


Video: The Beginning of Your Programming Journey

This course will teach you the basics of programming in Python. The first few videos will cover the fundamental concepts of computer programming, such as what a programming language is, what scripting is, and what languages are out there besides Python. You will also learn how all of this relates to IT.

The course will then move on to coding exercises, which will give you hands-on practice with Python. You will even write your very first Python script.

The instructor encourages you to watch the videos as many times as you need to and to ask questions in the discussion forums if you feel lost or confused.

The instructor also reminds you that everyone learns at their own pace, so don’t feel overwhelmed if you need to take more time on certain concepts.

In the next video, you will learn about what programming is.

As the Chinese proverb says, a journey of a thousand miles
begins with a single step. Today’s a big day, you’re
taking your first step in your journey to learn how
to write scripts in Python. It’s going to be a little
challenging at times, but really it’s not that scary. We’ll go slow and give you
everything you need to fully grasp each concept
before we move along. In the next few videos, you’ll discover the
fundamental concepts of computer programming. You’ll learn what a
programming language is, what scripting is, what languages are out
there other than Python, and how this all relates to IT. We’ll also have you coding
before you know it with small coding exercises
we’ve cooked up to give you hands-on
practice with Python. This will include writing your
very first Python script. But always keep in mind, if at any point along
the way you feel lost or confused, don’t panic. You can watch the
videos as many times as you need to let the
concept sink in, plus you can ask questions
in the discussion forums, which is one of the
best ways to find extra information and
connect with other learners. When I was asked to
participate in this program, it made me think about when
I first started to code. If I could give that
younger version of myself a piece of advice, this is what I would tell her, it never works the first time. Seriously, as a newbie, I expected it all
to work like magic. I thought that following
the rules and getting it right the first time would
prove my value as a coder, but that’s just not true, not even the best of the best. If you expect to
write perfect code on the first shot you’re
going to be disappointed. You hear that younger self? Try not to feel overwhelmed
by the details. Connecting the dots only
comes with experience, so the best way to learn
is to just jump in. The truth is everyone
learns at their own pace. If you already know
some of these concepts, feel free to skip ahead to the parts that
interests you the most. If you’re starting from scratch, take as long as you
need for each concept. The assessments
will be right there waiting for you when you’re done, and if at any point you start doubting
yourself, remember, even the most
advanced programmers started thinking, Python? What’s Python? Well, we’re about to learn all about
it, so let’s dive in. Next up, we’ll be doing a
rundown of what programming is.

Video: What is programming?

A computer program is a recipe of instructions that tells a computer what to do. It is written in a programming language, which has a syntax and semantics similar to human spoken languages.

There are many different programming languages to choose from, each with its own history, features, and applications. However, they all share the same fundamental ideas. Once you understand the basic concepts in one programming language, it becomes much easier to learn another.

Computers always do exactly what they are told, so it is important to be very clear when writing a program about what you want the computer to do. Learning the syntax and semantics of the programming language you choose will allow you to do just that.

A script is a program with a short development cycle that can be created and deployed rapidly. It is typically short, simple, and can be written very quickly.

In this course, you will learn the basics of programming using the Python scripting language. You will learn the Python syntax, the rules of how to write a Python program, and the semantics or meaning of the different pieces involved.

Before you start coding and writing your first Python script, you will learn more about what automation is and why it is useful.

What is programming?

Programming is the process of creating a set of instructions that tells a computer what to do. These instructions are called code, and they are written in a programming language.

A programming language is a set of rules that define how to write code. There are many different programming languages available, each with its own strengths and weaknesses. Some of the most popular programming languages include Python, Java, C++, and JavaScript.

How does programming work?

When you write code, you are essentially telling the computer what to do step-by-step. The computer will then follow your instructions and perform the task you have asked it to do.

For example, let’s say you want to write a program that prints the words “Hello, world!” to the screen. You could write the following code in Python:

Python

print("Hello, world!")

This code tells the computer to print the text “Hello, world!” to the screen. When you run this code, the computer will follow your instructions and print the text to the screen.

Why learn programming?

There are many reasons to learn programming. Here are a few of the reasons:

  • Programming is a valuable skill in today’s economy. Many jobs require programming skills, and the demand for programmers is only going to increase in the future.
  • Programming can be a creative outlet. It allows you to create new things and solve problems in new ways.
  • Programming can be challenging and rewarding. It is a great way to learn problem-solving skills and to improve your critical thinking abilities.
  • Programming can be fun! It can be a satisfying experience to create something that works and that you can share with others.

How to learn programming

There are many ways to learn programming. You can take a class, read a book, or watch online tutorials. There are also many online resources available, such as forums and Slack channels, where you can ask questions and get help from other programmers.

The best way to learn programming is to practice writing code. There are many exercises and projects available online that you can use to practice your skills.

Where to start?

If you are interested in learning programming, I recommend starting with a beginner-friendly programming language, such as Python or JavaScript. These languages are easy to learn and have a large community of users and developers who can help you if you get stuck.

Once you have learned the basics of a programming language, you can start to learn more advanced topics, such as data structures, algorithms, and object-oriented programming.

Conclusion

Programming is a valuable skill that can be learned by anyone. There are many resources available to help you learn programming, and the best way to learn is to practice writing code. If you are interested in learning programming, I encourage you to get started today!

At a basic level, a computer program is a recipe of instructions that tells
your computer what to do. When you write a program, you create a step by
step recipe of what needs to be done to
complete a task and when your computer executes
the program it reads what you wrote and follows your instructions to the letter. How nice is that? The recipe is written in a code called
programming language. Programming languages are
actually similar to humans spoken languages since they
have a syntax and semantics. Now if it’s been awhile since
your last grammar class, here’s a quick refresher
on syntax and semantics. In a human language, syntax is the rules
for how a sentence is constructed while
semantics refers to the actual meaning
of the statements. In English, sentences
generally have both a subject, that’s a person, place, or thing and a
predicate usually a verb and a statement that explains what the
subject is doing. Let’s take the sentence, Paula loves to program
in Python as an example. In this sentence, Paula is the subject and loves to program in Python
is the predicate. To form a sentence that
others can understand, you need to know both the
syntax that constructs the sentence and the semantics
that gives it meaning. The same applies to
programming languages. In a programming
language like Python, the syntax is the rules for
how each instruction is written and the semantics is the effects the
instructions have. Much like spoken languages, there are lots of programming
languages to choose from. Each has its own
history, features, and applications but they all share the same
fundamental ideas. So once you understand the basic concepts in one
programming language, it becomes much easier
to learn another. Lastly, computers always do
exactly what they’re told. So when you write a program, it’s important to be super clear about what you want
the computer to do. Learning the syntax
and semantics of the programming language
you choose will allow you to do just that. Make sense? Before we continue, let’s spend a moment
on terminology. In the next few
videos you’ll hear the term script
being used a bunch. So what’s the difference
between a script and a program? The line between the two
can be a bit blurry. In this course, we’ll use
the terms interchangeably. In general, you can think
of scripts as programs with a short development
cycle that can be created and deployed rapidly. In other words, a script is
a program that is short, simple, and can be
written very quickly. In this course we’ll focus on a specific scripting
language called python which we’ll use to learn the basics of programming. We’ll learn about
the python syntax, the rules of how to
write a python program, and the semantics or meaning of the different
pieces involved. Before we start
learning how to code and having you write your
first python script, let’s talk more about what automation is and
why it’s useful.

Did you get all that? Let's check with a quick question!
Why do we need to learn the syntax and semantics of a programming language?

To allow us to clearly express what we want the computer to do

You nailed it! Knowing the syntax and understanding the semantics of a programming language allows us to tell the computer what we want it to do.

Video: What is automation?

Automation is the process of replacing a manual step with one that happens automatically. It has many benefits, including saving time, reducing errors, increasing consistency, and providing a way to centralize solutions and mistakes.

However, automation is not a solution for every situation. Some tasks are not suited for automation because they require creativity, flexibility, or are too complicated or less frequently executed.

In this course, you will learn when it makes sense to apply automation and how to do it.

Here are some examples of automation in our daily lives:

  • Scheduled bill payments
  • Self-checkout machines at grocery stores
  • Coffee makers that start brewing before you wake up
  • Traffic lights
  • Automatic email replies

Automation can be used in many different industries, including IT, manufacturing, and customer service. It can be used to automate tasks such as:

  • Deploying software updates
  • Generating reports
  • Answering customer inquiries
  • Assembling products
  • Packaging products

Automation can make our lives easier and more efficient. It can also help businesses to be more productive and profitable.

What is automation?

Automation is the use of technology to perform tasks without human intervention. This can be done through the use of machines, robots, or software.

Why use automation?

There are many reasons to use automation. Here are a few of the benefits:

  • Increased efficiency: Automation can help to improve efficiency by freeing up humans to focus on more important tasks.
  • Reduced errors: Automation can help to reduce errors by eliminating human mistakes.
  • Improved consistency: Automation can help to improve consistency by ensuring that tasks are performed in the same way each time.
  • Increased safety: Automation can help to improve safety by reducing the risk of accidents.
  • Cost savings: Automation can help to save money by reducing the need for human labor.

What are the different types of automation?

There are many different types of automation. Here are a few of the most common types:

  • Robotics: Robotics is the use of robots to perform tasks. Robots can be used for a variety of tasks, such as manufacturing, assembly, and healthcare.
  • Machine learning: Machine learning is the use of computers to learn without being explicitly programmed. Machine learning can be used to automate tasks that are difficult or impossible to automate with traditional methods.
  • Process automation: Process automation is the use of software to automate business processes. This can include tasks such as billing, customer service, and inventory management.
  • Virtual assistants: Virtual assistants are software programs that can perform tasks on behalf of users. Virtual assistants can be used to answer questions, schedule appointments, and control smart home devices.

How to implement automation

The implementation of automation can vary depending on the specific task or process that is being automated. However, there are some general steps that can be followed:

  1. Identify the task or process that you want to automate.
  2. Determine the best way to automate the task or process. This may involve using robots, machine learning, or process automation software.
  3. Develop the automation solution. This may involve programming robots, writing machine learning algorithms, or configuring process automation software.
  4. Test the automation solution. This is important to ensure that the automation solution works correctly and does not introduce any errors.
  5. Deploy the automation solution. This involves making the automation solution available to the users who will be using it.

The future of automation

Automation is a rapidly growing field, and there is a lot of potential for automation in the future. Here are a few of the trends that are expected to drive the growth of automation:

  • The increasing availability of artificial intelligence (AI) and machine learning technologies.
  • The rising cost of labor.
  • The need to improve efficiency and productivity.
  • The desire to reduce errors and improve safety.

As automation continues to grow, it is important to consider the ethical implications of this technology. For example, it is important to ensure that automation does not lead to job losses or displacement. It is also important to ensure that automation is used in a safe and ethical manner.

[MUSIC] Although we might not realize it, we reap the benefits of automation
all the time in our daily lives. Do you ever pay your bills
with scheduled payments or use a self check out at the grocery store? I always set my coffee machine to start
brewing before I’ve even gotten out of bed. The promise of fresh coffee
makes early mornings way easier. Automation is the process of replacing
a manual step with one that happens automatically. Take a traffic light for example, which continuously regulates the flow
of vehicles at an intersection. A traffic light requires human
intervention only when it needs repairs or maintenance. The automatic regulation of traffic
means that humans don’t have to stand at the intersection manually signaling
when cars should stop or go. Instead, people can concentrate
on more complex, creative, or difficult tasks like focusing
on where you’re driving. What’s more,
traffic lights don’t get tired, bored, or accidentally display a green
light when they mean red. This highlights another benefit
of automation consistency. Let’s face it, us humans are flawed and
sometimes we make mistakes, a human performing the same tasks
hundreds of times will never be as consistent as a machine
doing the same thing. But for all of its advantages
automation isn’t a solution for every situation, some tasks just
aren’t suited for automation. For example, they may require a degree of
creativity or flexibility that automatic systems can’t provide or for more
complicated or less frequently executed tasks creating the automation may actually
be more effort or cost than it’s worth. Think about when you get a haircut. What would it take to automate the actions
of cutting hair with a machine? The client’s height,
the shape of their head, their current hair length,
and desired hairstyle would all need to be taken into account
when designing the automatic system. We need to replicate the creativity and
skills of a trained specialist along with extensive testing to ensure the clients
safety and quality haircut. And if you’ve ever had a bad
experience at a hair salon, you know quality can be subjective. In this case, the cost and effort of automation just isn’t
worth the benefits of an automatic haircut would provide which is why
we don’t have robot hairstylists. Not too complex, right? Automation is a powerful tool when used
in the right place at the right moment. It can save time, reduce errors,
increase consistency, and provide a way to centralize solutions and
mistakes, making them easier to fix. Throughout this course, and in upcoming
ones we’ll be talking about when it makes sense to apply automation and
exactly how you do it. Eventually knowing when and where to use
automation will become automatic for you.

Let's check that this all made sense with a quick question!
What’s automation?

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

Right on! By replacing a manual step with an automatic one we create automation that helps us reduce unnecessary manual work.

Video: Getting Computers to Work for You

Automation is the process of using computers to perform tasks that would otherwise be done manually. It can be used to save time, reduce errors, and increase consistency.

Automation is especially well-suited for tasks that are performed repeatedly with little variation. For example, you could use automation to check for duplicate email addresses in a list, or to send personalized emails.

Learning how to program is the first step to being able to automate tasks. Once you know how to program, you can write scripts or programs to automate any task that you can imagine.

Here are some examples of tasks that can be automated:

  • Deploying software updates
  • Generating reports
  • Answering customer inquiries
  • Assembling products
  • Packaging products
  • Sending personalized emails
  • Checking for duplicate data
  • Updating permissions on files and folders

Automation can make your life easier and more efficient. It can also help businesses to be more productive and profitable.

Introduction

Computers are powerful tools that can be used to automate tasks, save time, and improve productivity. However, in order to get the most out of computers, it is important to learn how to program them. Programming is the process of creating instructions for a computer to follow. By learning how to program, you can create your own automated tasks and applications.

What is programming?

Programming is the process of creating instructions for a computer to follow. These instructions are called code. Code is written in a programming language, which is a set of rules that define how the computer should interpret the instructions.

Why learn programming?

There are many reasons to learn programming. Here are a few of the benefits:

  • Automate tasks: Programming can be used to automate tasks, which can save time and reduce errors.
  • Create applications: Programming can be used to create applications, such as games, websites, and software programs.
  • Solve problems: Programming can be used to solve problems, such as finding the most efficient way to sort a list of data.
  • Build your skills: Programming is a valuable skill that can be used in many different fields, such as IT, engineering, and data science.
  • Learn how computers work: Programming gives you a deeper understanding of how computers work.

How to learn programming

There are many ways to learn programming. Here are a few of the options:

  • Take a programming class: This is a great way to learn the basics of programming from a qualified instructor.
  • Read a programming book: There are many books available that teach programming.
  • Watch online tutorials: There are many online tutorials available that can teach you programming.
  • Practice programming: The best way to learn programming is to practice. Try to write small programs to solve simple problems.

Getting started with programming

If you are interested in learning programming, here are a few things you can do to get started:

  • Choose a programming language: There are many different programming languages available. Some popular languages include Python, Java, and JavaScript.
  • Find a good learning resource: There are many different learning resources available, such as books, online tutorials, and coding bootcamps.
  • Set realistic goals: Don’t try to learn everything at once. Start with the basics and gradually build your skills.
  • Practice regularly: The best way to learn programming is to practice regularly. Try to set aside some time each day to practice coding.

Conclusion

Programming is a valuable skill that can be used to automate tasks, create applications, and solve problems. If you are interested in learning programming, there are many resources available to help you get started. With practice, you can become a skilled programmer and use your skills to make a difference in the world.

Here are some additional tips for getting computers to work for you:

  • Identify the tasks that you want to automate.
  • Determine the best way to automate the tasks. This may involve using a programming language, a scripting language, or a software application.
  • Develop the automation solution. This may involve writing code, creating scripts, or configuring software.
  • Test the automation solution. This is important to ensure that the automation solution works correctly and does not introduce any errors.
  • Deploy the automation solution. This involves making the automation solution available to the users who will be using it.

With a little effort, you can learn how to get computers to work for you. This can save you time, reduce errors, and improve your productivity.

Working in IT, a lot of what we do boils down to using
a computer to perform a certain task. In your job you might create user
accounts, configure the network, install software, backup existing data, or execute a whole range of other
computer based tasks from day to day. Back in my first IT job, I realized
that every day I came into work I typed the same three commands to
authenticate into systems. Those credentials timed out everyday
by design, for security reasons, so I created a script that would
automatically run these commands for me every morning to avoid
having to type them myself. Funny enough, the team that monitors
anomalous activity discovered my little invention and
contacted me to remove it, oops. Tasks performed by a computer that need
to be done multiple times with little variation are really well suited for
automation, because when you automate a task you avoid
the possibility of human errors, and reduce the time it takes to do it. Imagine this scenario: your company
had a booth at a recent conference and has gathered a huge list of emails from
people interested in learning more about your products. You want to send these people
your monthly email newsletter, but some of the people on the list
are already subscribed to receive it. So how do you make sure everyone
receives your newsletter, without accidentally sending
it to the same person twice? Well, you could manually check each email
address one by one to make sure you only add new ones to the list,
sounds boring and inefficient, right? It could be, and
it’s also more error prone, you might accidentally miss new emails,
or add emails that were already there, or it might get so
boring you fall asleep at your desk. Even your automated coffee
machine won’t help you out there. So what could you do instead? You could get the computer
to do the work for you. You could write a program that checks for
duplicates, and then adds each new email to the list. Your computer will do exactly as it’s
told no matter how many emails there are in the list, so
it won’t get tired or make any mistakes. Even better, once you’ve written
the program you can use the same code in future situations, saving you
even more time, pretty cool, right? It gets better, think about when
you’re going to send these emails out, if you send them out manually you’ll have
to send the same email to everybody, personalizing the emails would
be way too much manual work. If instead you use automation to send
them, you could have the name and company of each person added
to the email automatically. The result? More effective emails, without you spending hours
inserting names into the text. Automating tasks allows you to focus on
projects that are a better use of your time, letting computers do
the boring stuff for you. Learning how to program is the first
step to being able to do this. If you want to get computers to do the
work for you, you’re in the right place. Earlier in this video I told you about
the first task I ever automated, now I want to tell you about
the coolest thing I ever automated. It was a script that changed
a bunch of access permissions for a whole lot of Google Internal Services. The script traversed a large directory
tree with tons of different files, checked the file contents, and then
updated the permissions to the services based on the conditions that
I laid out in the script. Okay, I admit I’m a total nerd, but
I still think it’s really cool. Next up, it’s time to share your ideas. What things would you like to
automate using programming? While these discussion prompts
are optional, they’re really fun. Seriously, they let you get to know
your fellow learners a bit, and collaborate on ideas and insights. Make sure you read what others are saying, they may give you ideas that
you haven’t even thought of. After that, you’re ready to take
your very first quiz of the course. Don’t worry, it’s just for practice.

Which of the following tasks do you think are good candidates for automation? Check all that apply.

Installing software on laptops given to new employees when they are hired

Right on! Installing and configuring software is a task that can be automated. Ensuring that everyone gets the exact same setup and reducing the amount of manual work needed for each new employee.

Periodically scanning the disk usage of a group of fileservers

You nailed it! Scanning the disk usage is a task that can be easily automated. By letting the computer do it, you won’t have to worry about forgetting to do it whenever it’s needed.

Practice Quiz: Introduction to Programming

What’s a computer program?

What’s the syntax of a language?

What’s the difference between a program and a script?

Which of these scenarios are good candidates for automation? Select all that apply.

What are semantics when applied to programming code and pseudocode?

Introduction to Python


Video: What is Python?

This course will use the Python programming language to demonstrate basic programming concepts and how to apply them to writing scripts. Python was chosen because it is easy to read and write, making it a good choice for beginners.

Throughout the course, you will execute Python code using your web browser. You will start with small coding exercises using code blocks and then move on to larger more complex coding exercises using other tools.

It is important to practice programming regularly. You can practice the examples shared in the course on your own or use an online Python interpreter.

A Python interpreter is a program that reads and executes code written in Python.

Eventually, you will want to install Python on your computer so you can run it locally and experiment with it as much as you like. The course will guide you through how to install Python.

In the meantime, you can practice with the quizzes provided in the course and with the online interpreters and code pads that will be linked to in the next reading.

You are encouraged to come up with your own programming exercises and share them in the discussion forums. This is a great way to show off your new skills and learn from others.

Python is a general-purpose, interpreted, high-level programming language. Its design philosophy emphasizes code readability with its notable use of significant whitespace. Its language constructs and object-oriented approach aim to help programmers write clear, logical code for small and large-scale projects.

Python is dynamically typed and garbage-collected. It supports multiple programming paradigms, including structured (particularly procedural), object-oriented, and functional programming. Python is often described as a “batteries included” language due to its comprehensive standard library.

Python is used in a wide variety of domains, including web development, data science, machine learning, artificial intelligence, and scientific computing. It is also used in education, system administration, and game development.

Here are some of the benefits of using Python:

  • Easy to learn: Python is a relatively easy language to learn, even for beginners. Its syntax is simple and straightforward, and its indentation rules make code easy to read.
  • Versatile: Python can be used for a wide variety of tasks, from simple scripting to complex data analysis. It is also a good language for beginners to learn because it can be used to build real-world applications.
  • Free and open-source: Python is a free and open-source language, which means that it is available to everyone to use and modify. This makes it a popular choice for students and hobbyists.
  • Large community: Python has a large and active community of users and developers. This means that there are many resources available to help you learn Python, and you can always get help if you get stuck.

If you are interested in learning Python, there are many resources available to you. There are many online tutorials and courses, and there are also many books and articles on the subject. You can also find Python user groups and forums where you can ask questions and get help from other users.

Here are some of the best resources for learning Python:

  • Python Tutorial: https://docs.python.org/3/tutorial/ by the Python Software Foundation Learn Python: https://www.learnpython.org/ by Free Code Camp Python for Beginners: https://www.w3schools.com/python/ by W3Schools Python Programming Tutorial: https://www.tutorialspoint.com/python/ by TutorialsPoint

Welcome back. How did you
do on your first quiz? If you got most of the
questions right, great job. If not, no worries it’s
all part of learning. We’ll be here to help you
check that you’ve really got your head around these concepts with regular quizzes like this. If you ever find a
question tricky, go back and review the videos and then try the quiz again. You want to feel super
comfortable with what you’ve learned before jumping
into the next lesson. Remember, take your time. I will be here whenever
you’re ready to move on. Okay. Feeling good? Great. Let us dive in. In this course, we will use the Python programming
language to demonstrate basic
programming concepts and how to apply them
to writing scripts. We have mentioned that
there are a bunch of programming
languages out there. So why pick Python? Well, we chose Python
for a few reasons. First off, programming
in Python usually feels similar to using
a human language. This is because Python makes
it easy to express what we want to do with syntax that’s
easy to read and write. Check out this example. There is a lot to
unpack here so don’t worry if you don’t
understand it right away, we’ll get into the nitty-gritty details later in the course. But even if you’ve never
seen a line of code before, you might be able to guess
what this code does. It defines a list
with names of friends and then creates a greeting
for each name in the list. Now it is your turn to
make friends with Python. Try it out and see what happens. Throughout this course,
you will execute Python code using
your web browser. We’ll start with some small
coding exercises using code blocks just like the
one you experimented with. Later on as you
develop your skills, you’ll work on larger more complex coding exercises
using other tools. Getting good at something
takes a whole lot of practice and programming
and Python is no different. We recommend that you practice every example we share in
this course on your own. If you do not have Python
installed on your machine, no worries, you can still practice using an online
Python interpreter. Check out the next
reading for links to the most popular Python
interpreters available online. Now I am sure you are wondering what the heck is a
Python interpreter. In programming, an interpreter is the program that reads
and executes code. Remember how we said a
computer program is like a recipe with step-by-step
instructions? Well, if your recipe
is written in Python, the Python interpreter is the program that reads what is in the recipe and translates it into instructions for your
computer to follow. Eventually, you’ll want to install Python on
your computer so you can run it locally and experiment with it
as much as you like. We’ll guide you through
how to install Python in the upcoming course
but you don’t have to have it installed to get
your first taste of Python. You can practice with the
quizzes we provide and with the online interpreters
and code pads that we’ll give you links
to in the next reading. We’ll provide a whole bunch
of exercises for you but feel free to come up with your own and share them in the
discussion forums. Feel free to get creative. This is your chance to
show off your new skills.

Execute the following code and see what happens. Feel free to change it and run it as many times as you want.
friends = ['Taylor', 'Alex', 'Pat', 'Eli']
for friend in friends:
    print("Hi " + friend)

Output: Hi Taylor Hi Alex Hi Pat Hi Eli

Reading: Python Resources

Reading

Reading: A Note on Syntax and Code Blocks

Reading

Video: Why is Python relevant to IT?

Python is a popular programming language in the IT industry. It is used in a wide variety of applications, including web development, machine learning, and data analytics. Python is also available for download on a wide variety of operating systems.

Here are some of the reasons why Python is relevant to today’s IT industry:

  • It is easy to learn and use.
  • It is powerful and versatile.
  • It is popular and has a large community of developers.
  • It is available for download on a wide variety of operating systems.

If you are interested in learning Python, there are many resources available online, including courses, documentation, and discussion forums. You can also ask questions from other developers in the community.

Additional tips:

  • Don’t be afraid to experiment and make mistakes.
  • Seek help when you get stuck.
  • Use the resources available to you, such as online courses, documentation, and discussion forums.
  • Never give up!

Python is a general-purpose programming language that is becoming increasingly popular in the IT industry. It is known for its simplicity, readability, and versatility, making it a good choice for a wide range of tasks.

Here are some of the reasons why Python is relevant to IT:

  • Data science and machine learning: Python is a popular language for data science and machine learning. It has a large number of libraries and tools that make it easy to work with data, and it is also well-suited for developing machine learning algorithms.
  • Web development: Python is a popular language for web development. It is used to create both front-end and back-end applications, and it is also a good choice for developing APIs.
  • Software development: Python is a general-purpose language, so it can be used to develop a wide range of software applications. It is particularly well-suited for developing scientific and engineering applications, as well as educational and entertainment applications.
  • Automation: Python can be used to automate tasks, such as data collection, processing, and analysis. This can save time and effort, and it can also improve the efficiency of IT operations.
  • System administration: Python can be used to manage and maintain IT systems. This includes tasks such as monitoring systems, troubleshooting problems, and deploying software updates.

Overall, Python is a versatile and powerful language that is relevant to many areas of IT. If you are interested in a career in IT, learning Python is a good way to set yourself up for success.

Here are some specific examples of how Python is used in IT:

  • Spotify uses Python to recommend songs to users.
  • Netflix uses Python to personalize the user experience.
  • Google uses Python to power its search engine.
  • NASA uses Python to control its spacecraft.
  • The US military uses Python to develop its weapons systems.

These are just a few examples of how Python is used in IT. As the language continues to grow in popularity, it is likely that we will see even more innovative and groundbreaking applications of Python in the years to come.

I hope this tutorial has given you a better understanding of why Python is relevant to IT. If you are interested in learning more about Python, there are many resources available online and in libraries. With a little effort, you can quickly learn the basics of Python and start using it to create your own projects.

[MUSIC] Remember how we mentioned that
Python is simple and easy to use? Python makes it easy to express
the fundamental concepts of programming like data structures and
algorithms with easy to read syntax. This makes Python a great language
to use to learn programming. And there are other reasons
to pick Python, too. Python is super popular
in the IT industry, making it one of the most common
programming languages used today. Python isn’t new. Its first version was released by
Guido van Rossum back in 1991. Since then, the community that
develops it has grown and the language has advanced a lot. Whenever there’s a significant change to
the semantics or syntax of the language, a new major version is released. In 2000, Python 2 was released. In 2008, we got Python 3. In this course, we’ll use Python 3.7,
which came out in 2018. For many years, Python was considered
a beginner’s language and was mostly used for teaching concepts or writing very
small simple scripts, like in this course. But in recent years, the adoption
of Python has grown dramatically. One reason for this is that
the language has become more powerful. It’s also because there’s more
tools available in Python for a growing range of applications. You can use Python to calculate
statistics, run your e-commerce site, process images,
interact with web services, and do a whole host of other tasks. Python is perfect for automation. It lets you automate everyday tasks by
writing simple scripts that are easy to understand and easy to maintain. That’s why Python is the language of
choice for lots of people working in IT support, system administration,
and web development. Not only that, but it’s also used
in fast-growing areas of IT, like machine learning or data analytics. Last but not least,
Python is available for download on a wide variety of operating
systems, like Windows, Linux, and Mac OS. And what’s more, Python is so popular in
the workplace that if you are currently working in IT,
you’ve most likely encountered it already. And if you’re planning a career in IT, chances are you’ll interact
with Python quite a bit. So there’s a whole lot of reasons for why
Python is relevant to today’s IT industry. A large part of programming
is learning through trial and error and asking questions. So if at any point you get stuck,
don’t get discouraged. Making mistakes helps you improve. The more you see failure or
broken code as an opportunity to learn, the quicker you’ll master programming. I remember the first Python
script I ever wrote. It took a lot of refactoring, debugging,
and testing to get it to work. I relied on a lot of my teammates for
help and mentorship and wound up spending more time on Stack
Overflow than actually writing the code. Thankfully, you don’t have
to reinvent the wheel. There’s almost always someone on the
Internet who’s trying to do what you’re doing and can help point you in
the right direction when you’re stuck. Sometimes it takes a village. It’s really important to keep in mind that
even experienced programmers may need to ask a colleague a question from time to
time or look something up on the Internet. Whether you’re a programming novice or have some experience in
software development, remember, the best programmers overcome challenges
by seeking help or using other resources. Once you’ve completed this program, you’ll be well on your way to
confidently programming in basic Python. There’s lots of information online that
will help you continue to develop your programming skills. For example,
there are lots of online courses for specific programming languages. You’ll find answers to your Python
coding questions in the official Python documentation. You can use sites like Stack Overflow to
discuss and share with other developers. And you can ask questions
in our discussion forums. You can even subscribe to some of
the Python mailing lists to keep in the know on the latest
updates to the language. You’re opening the door to
the whole world of programming, and it’s super exciting to be joining
the development community. The most important thing to remember
is that you’re never alone. Any questions you may have,
any time in your career, there are resources out there to
help you find the answers you need. Wow, [LAUGH] that was
a lot of information. Feel free to take a quick break,
grab something to drink, and then head on over to the supplemental
reading to learn more about Python and the resources out there to help you learn.

Let's check whether you soaked all that in with a quick question! Select all options that explain why Python is relevant to today’s IT industry.

Python scripts are easy to write, understand, and maintain.

Woohoo! Python is a language that tries to mimic our natural language and so Python scripts are generally easy to write, understand and maintain.

There are many system administration tools built with Python.

You got it! Over the years, the Python community has developed a lot of additional tools that can be used by system administrators to get their job done.

Python is available on a wide variety of platforms.

Well done, you! Python is available on Windows, Linux, MacOS and even on mobile devices, making it a great tool for IT specialists looking to create scripts that can work across platforms.

Video: Other Languages

  • Python is just one of many programming languages out there, each with its own unique pros and cons.
  • Other popular programming languages include Perl, Ruby, JavaScript, C, C++, Java, and Go.
  • Once you learn the basics of programming in one language, it is easier to learn other languages, as they share many similarities.
  • Here is a simple program that prints “hello world” ten times in Python, Bash, and PowerShell:
# Python
for i in range(10):
  print("hello world")
# Bash
for i in {1..10}; do
  echo "hello world"
done
# PowerShell
for ($i = 1; $i -le 10; $i++) {
  Write-Host "hello world"
}

As you can see, each language has a different syntax for printing “hello world” and counting to ten. However, there are also similarities, such as the need to put text on the screen and count to ten.

Conclusion:

The most important thing is to learn the basics of programming, which can be applied to any programming language. Once you have a good understanding of the fundamentals, it will be easier to learn new languages.

[MUSIC] Although we picked Python for this course, it’s important to note that it’s just one
of the many coding languages out there. Think of a given programming language as
just one of the many powerful tools in your IT toolbox. Each language has its unique
set of pros and cons. Some run faster than others. Some are better suited for
enterprise applications. Others are particularly
good at crunching numbers. There are platform-specific
scripting languages like PowerShell which is used on Windows, and
Bash which is used on Linux. Both are widely used by system
administrators on those platforms. There are also general-purpose scripting
languages similar to Python, like Perl or Ruby, which are also widely used for
scripting and automation. JavaScript, which was originally developed
as a client-side scripting language for the web, is increasingly used server-side
for a broader set of tasks. And the list doesn’t stop there. There’s a vast array of traditional
languages to explore like C, C++, Java, or Go. As you progress in your career in IT,
you’ll probably encounter a number of different languages and
learn when to use each of them. But let’s not get ahead of ourselves. First, we have Python to
get our heads around. A nice feature of learning the basics of
programming in one language is that you can generally apply the same concepts
you learn to other languages. This means that once you’re
familiar with Python, you’ll find it easier to pick up new
coding languages as you’ll spot and understand similarities and
differences between them. After all, every language needs to do
some common things like create variables, control the flow of a program,
read input, and display output, even if they do these tasks
using different approaches. As we called out earlier, learning
a programming language is somewhat similar to learning a foreign language. You’ll need to grasp the syntax and
semantics for that language. Luckily for us, once you know
the fundamentals of programming, learning another language is much easier
than learning a second foreign language. There are a lot more similarities between
programming languages than differences. To explore some of the similarities and
differences between various scripting languages, let’s take a look at a simple
program that prints the words hello world ten times in three different languages,
Python, Bash, and PowerShell. As you can see, each language uses a different
approach to printing hello world. But look closer and
you’ll see similarities too. Each language must somehow
put text onto the screen. The command for Python is print,
for Bash it’s Echo, and for PowerShell it’s Write-Host. Also notice that each language
has to count to ten in some way. While Python does this
by specifying range(10), Bash uses a sequence notation
to count from 1 to 10. PowerShell has the most complex
syntax in this example, but it also boils down to starting at 1 and
counting up to 10. So as we’ve just seen there’s a whole
lot of programming languages out there, but don’t let that scare you. In this course, you will only
need to focus on learning Python. Once you can speak Python you can go on
to learn any other language you want. Up next, we’ve got another quiz to help
you practice what you’ve just learned.

Practice Quiz: Practice Quiz: Introduction to Python

Fill in the correct Python command to put “My first Python program” onto the screen.

Python is an example of what type of programming language?

Convert this Bash command into Python:

Fill in the correct Python commands to put “This is fun!” onto the screen 5 times.

Select the Python code snippet that corresponds to the following Javascript snippet:
for (let i = 0; i < 10; i++) {
console.log(i);
}

Hello World


Video: Hello, World!

The following Python code prints “hello world” to the screen:

print("hello world")

The print() function writes whatever is between the double quotation marks to the screen.

Keywords:

Keywords are reserved words that have special meaning to the Python interpreter. Some examples of keywords include if, while, and for.

Functions:

Functions are pieces of code that perform a unit of work. The print() function is a built-in function that is part of the Python language.

Strings:

Strings are text that is manipulated by Python scripts. Strings are wrapped in double quotation marks.

Why “hello world”?:

Printing “hello world” to the screen is a traditional way to start learning a programming language. It is a simple example that demonstrates how to use functions and how a program written in that language looks.

Conclusion:

The “hello world” example is a good starting point for learning Python. It gives you a first impression of how functions are used and how a program written in Python looks.

The “Hello, World!” program is a traditional way to start learning a programming language. It is a simple program that prints the message “Hello, World!” to the screen.

To write a “Hello, World!” program in Python, you will need to create a file with the .py extension. In this file, you will need to write the following code:

print("Hello, World!")

This code uses the print() function to print the message “Hello, World!” to the screen. The print() function is a built-in function in Python that prints text to the screen.

To run the program, you can save the file and then open a terminal window. In the terminal window, navigate to the directory where the file is located. Then, type the following command:

python hello_world.py

This command will run the program and print the message “Hello, World!” to the screen.

Here are some additional tips for writing a “Hello, World!” program in Python:

  • Use a text editor to create the file.
  • Save the file with the .py extension.
  • Use the print() function to print text to the screen.
  • Run the program in a terminal window.

By following these tips, you can write a “Hello, World!” program in Python.

Here are some variations of the “Hello, World!” program:

  • You can change the message to anything you want.
  • You can add formatting to the message, such as bold or italics.
  • You can use variables to store the message and then print the variable.
  • You can use functions to make the code more modular.

By experimenting with different variations, you can learn more about how Python works.

Now that you’ve got
an idea of what Python code looks like, let’s check out one of the most basic examples and dive deeper into what’s
going on. Get ready. We’re going to use the
Python interpreter to make our computer say
hello to the world. When we run this code either locally on our machine
or on a web interpreter, the words hello world appear on the screen, just like magic. Actually it’s not magic. It’s because Print is a Python function that writes what we tell it to on the screen. Like the statement hello
world for example, the print function is part of
the basic Python language, whenever we use keywords or functions that are
part of the language, we’re using the programming
language’s syntax to tell the computer what to do. So what are functions
and keywords? Functions are pieces of code
that perform a unit of work. We’ll talk a lot more
about functions later on, and you’ll even learn
how to write your own. Keywords are reserved words that are used to construct
instructions. These words are the core part of the language and can only
be used in specific ways. Some examples include
if, while, and for. We’ll explain all of those and a bunch more
later in the course. As we called out, the keywords
and functions used in Python are what makes up
the syntax of the language. Once we understand how they work, we can use them to construct more complex expressions that get the computer to do
what we want it to do. Last off, notice how hello world is written between
double quotation marks. Wrapping text in quotation marks indicates that the text
is considered a string, which means it’s text that will be manipulated by our script. In programming, any
text that isn’t inside quotation marks is
considered part of the code. Now, for a bit of trivia, do you know why we printed the whole world in our example? Well, printing hello
world has been the traditional way to start learning a programming
language since way back in the ’70s when it was
used as the first example in a famous programming book called the C
programming language. That example looked like this. In Python, the hello world
example is just one line, in C, it’s three lines, in other languages,
it can be even more. While learning to
write hello world won’t teach you the
whole language, it gives you a first impression of how functions are used, and how a program written
in that language looks. All right, now that we’ve written our first piece of Python code, I think you’re ready
for something a bit more challenging
than hello world. Ready? Let’s do it.

Now that you know what’s going on with this piece of code, try making Python output a different string. Write a Python script that outputs "I'm programming in Python!" to the screen. Remember that you need to use the print() function and use quotation marks to delimiter the string.
print("I'm programming in Python!")

Here is your output: I’m programming in Python! Nice job! You just programmed a script in Python that says that you are programming in Python, which is pretty meta. It also means you just wrote your first Python script and got your computer to do what you want. Feels pretty great, right?

Video: Getting Information from the User

  • A useful program needs to get information from the user.
  • Data can be provided to a computer in a bunch of different ways, such as entering text into text fields, clicking links, or passing strings as parameters.
  • Data can also be provided from files or other sources.
  • In simple examples, we can just have the data as its own line in our block of code.
  • This is limited, but straightforward.
  • We can make our code more generic by having the data separate from the call to the print function.

Example:

# This code prints "hello, world!"
print("hello, world!")

# This code prints "hello, Alice!"
name = "Alice"
print("hello, " + name + "!")

In the second example, the line of code that calls the print() function is generic, but we can personalize the greeting by changing the value of the name variable.

Conclusion:

This lesson introduces the concept of providing data to a program. We will learn more about better ways to feed data into our code in later lessons.

In Python, there are several ways to get information from the user. One way is to use the input() function. The input() function takes a prompt as its argument and returns the user’s input as a string.

For example, the following code will ask the user for their name and then print it back to them:

name = input("What is your name? ")
print("Your name is", name)

Another way to get information from the user is to use the raw_input() function. The raw_input() function is similar to the input() function, but it does not convert the user’s input to a string. This means that the user can enter any type of data, including numbers, symbols, and spaces.

For example, the following code will ask the user for their age and then print it back to them:

age = raw_input("How old are you? ")
print("You are", age)

The input() and raw_input() functions are both useful for getting information from the user. However, the input() function is more commonly used because it is easier to use and more versatile.

Here are some additional tips for getting information from the user in Python:

  • Use clear and concise prompts.
  • Make sure that the prompts are appropriate for the type of data that you are trying to get from the user.
  • Validate the user’s input to ensure that it is the correct type and format.
  • Handle errors gracefully. For example, if the user enters invalid data, you can display an error message and ask them to try again.

By following these tips, you can get information from the user in a way that is efficient and user-friendly.

[MUSIC] On the whole, for a program to be useful it needs to get
at least some information from the user. With this data, the program can take
actions that are relevant to the user, instead of generic actions,
like printing hello world. Data can be provided to a computer
in a bunch of different ways. For example, on a website you might input
data by entering text into text fields or clicking links. If you’re using a mobile application,
maybe you’ll click on buttons or select preferences from a drop-down menu. In a command line program, you might
provide additional data by passing strings as parameters to the program, or you could have the program ask you for
data interactively. All of these various platforms, programs,
and apps process data differently. Some might take the contents of
a file as data to be processed, others gather data from other sources and
process it in the background. Remember our earlier example, when we
automated the process of identifying and removing duplicate emails? There, the data provided to
the program was the list of emails, which would usually be given in a file
that lists the emails one per line. Whichever way your application gets the
data, it will need to come from somewhere. For our first examples in this course, we’ll just have the data as its
own line in our block of code. This is limited, but straightforward. Later in this course,
and in upcoming courses, we’ll introduce you to better ways
of feeding data into your code. For now though, let’s see this idea
in action in a very simple example. By having the name separate from
the call to the print function, we’re making the line of code that
calls the print function generic, while still personalizing the greeting. If we then want to say hello to
a different person, we only need to change the name, but the call to the print
function will remain the same. Pretty simple, right? Next up, we’ll learn a few other easy things
that you can get Python to do for you.

Video: Python Can Be Your Calculator

Python can be used as a calculator to perform basic and advanced mathematical operations.

Examples:

  • 4 + 5 = 9
  • 9 * 7 = 63
  • (2050 / 5) – 32 / 9 = 26.222222222222222
  • 2 ** 10 = 1024

Why use Python instead of a normal calculator?

  • Experimenting with Python helps you get familiar with its math capabilities.
  • You can use Python to write scripts to automate mathematical tasks, such as counting the number of times a certain word appears in a text or working out the average time it takes for an operation to complete.

Conclusion:

Python is a powerful tool that can be used for a variety of mathematical tasks. If you are interested in learning more about Python’s advanced numeric capabilities, there are many resources available online.

Python is a general-purpose programming language that can be used for a variety of tasks, including data analysis, machine learning, and web development. However, Python can also be used as a calculator to perform basic mathematical operations.

To use Python as a calculator, you can use the built-in print() function to display the results of your calculations. For example, the following code will print the result of 2 + 3:

print(2 + 3)

This code will print the number 5 to the console.

You can also use the input() function to get input from the user and then perform calculations on that input. For example, the following code will ask the user for two numbers and then print the sum of those numbers:

first_number = input("Enter the first number: ")
second_number = input("Enter the second number: ")

sum = first_number + second_number

print("The sum of the two numbers is", sum)

This code will first ask the user for the first number. The user’s input will be stored in the variable first_number. The code will then ask the user for the second number. The user’s input will be stored in the variable second_number.

The code will then calculate the sum of the two numbers and store the result in the variable sum. Finally, the code will print the value of sum to the console.

Here are some other basic mathematical operations that you can perform in Python:

  • Subtraction: -
  • Multiplication: *
  • Division: /
  • Exponentiation: **
  • Modulo: %

You can also use Python to perform more complex mathematical operations, such as trigonometric functions and logarithms.

If you are interested in learning more about how to use Python as a calculator, there are many resources available online. You can also find many examples of Python code that performs mathematical calculations.

Here are some additional tips for using Python as a calculator:

  • Use clear and concise variable names.
  • Use comments to explain your code.
  • Test your code with different inputs.
  • Document your code so that others can understand it.

By following these tips, you can write clear and concise Python code that performs mathematical calculations.

There’s a ton of things
that you can do with Python and you’ll learn many
of them in this course. But before we dive
into complex subjects, let’s have some fun with
another simple task that you can do with Python. We are going to make
Python our calculator. Let’s start with something easy. So 4 plus 5 is 9, 9 times 7 is 63, minus 1 divided by
4 is minus 0.25. Easy. Repeating or
periodic numbers are printed in a longer format. Let’s try 1 divided by 3. In math theory, when
1 is divided by 3, the digit 3 repeats forever
after the decimal point. Of course, it’s hard to display something that repeats forever. So instead, we have a representation showing
lots of decimal places. Not too hard, right? Let’s get the computer
something a bit trickier. Let’s say we want to
divide 2050 by 5, then subtract 32 and then
divide the result by 9. To do this, we’ll need
to use parentheses, just as we do in
typical math problems. You can also use
Python to get squares, cubes, or any power
of n of a number. For example, let’s
say we want to find out what 2 to the power of 10 is. To get Python to
give us the answer, we use the double star operator. If you’re starting to worry
that this is becoming an algebra course, relax. We’re not going to
do anything more complex than what
we’ve just seen. If you’re thinking, “Why would I use Python instead of just
a normal calculator?” That’s a valid question. Experimenting in this way, you get familiar with the
language’s math capabilities. In IT jobs, there are many tasks that require you
to use math calculations. You might need to
count how many times a certain word appears in a text, or work out the average time it takes for an operation
to complete, or how much you have to compress an image to fit in
certain size constraints. Whatever you need to calculate, writing a script
can help you do it faster and with more accuracy. So you need to know
what mathematical operations are available to you. Python actually has
a lot more advanced numeric capabilities that
are used for data analysis, statistics, machine learning, and other scientific
applications. We won’t get into
these in this course. But if you want to learn
more about them on your own, there’s a wealth of online
resources available. Next up, a cheat
sheet to help you with programming concepts
that we’ve just covered. After that, it’s time
for another quiz. This time with a few
small coding exercises. Remember, if
something is unclear, you can re-watch the videos
as many times as you need. Ready? You’ve got this.

Now it’s your turn to try! Give this a go yourself.

Use Python to calculate (((1+2)∗3)/4)5(((1+2)∗3)/4)5

Tip: remember that you can use a**b to calculate a to the power of b.

print((((1+2)*3)/4)**5)

Here is your output: 57.6650390625 Awesome! You are making Python do all the math for you!

Reading: First Programming Concepts Cheat Sheet

Reading

Practice Quiz: Practice Quiz: Hello World

What are functions in Python?

What are keywords in Python?

What does the print function do in Python?

Output a message that says “Programming in Python is fun!” to the screen.

Replace the _ placeholder and calculate the Golden ratio:
Tip: to calculate the square root of a number x, you can use x**(1/2).

Module Review


Video: First Steps Wrap Up

This module has covered the following topics:

  • What is scripting?
  • What is the syntax and semantics of a programming language?
  • What is automation?
  • Why is Python relevant to IT?
  • What other programming languages are available?
  • How to input data in Python
  • How to write a Python script to process data
  • How to use Python to perform mathematical calculations

Conclusion:

Congratulations on completing the first module! You have taken the first steps to learning a new programming language and growing your IT skillset.

The next step is to take the first graded assessment. These assessments help you check whether you have understood all the concepts and that you are ready to move on to the next stage. Don’t worry, you can always review the videos and readings if you are not sure about a question.

Everybody learns at different speeds, so take your time and really get familiar with the concepts. Once you feel ready, the assessment is there waiting for you.

Good luck!

Congrats. You made it to the end of the first
module. Great job. You’ve taken the first steps to learning a new
programming language, and growing your IT skillset. Getting there shows real determination and
a will to learn. We’ve covered a lot of topics, and many might be new to you if you’ve never learned
about programming before. You’ve discovered
what scripting is, what the syntax and semantics of a programming language
are all about, and how they relate
to automation. We’ve got to grip some small
blocks of Python code, talked about why Python
is relevant to IT, and explored what other programming languages
are available. We’ve had our first approach
to how to input data, and write a script that
puts this data to use, and we’ve seen how
you can use Python to perform typical
math calculations. Not bad for your first
Python steps, right? This is just the beginning
of an exciting journey, learning to code, and we hope
you’re eager to learn more. Coming up, get ready for your
first graded assessment. These assessments help you check whether you’ve understood all the concepts and that you’re ready to move on
to the next stage. Now, don’t worry. If at any point you’re not
sure about a question, you can always review the videos and readings to remind
yourself of the answer. Remember, that everybody
learns at different speeds. So take your time, really get
familiar with the concepts. Once you feel ready,
the assessment is there waiting for you. I’ll see you back here
once you’ve nailed it.

Video: Meet Marga, the Curriculum Developer

Margarita Manterola is a Site Reliability Engineer in the G Linux team. She is passionate about teaching programming to everyone. She believes that everyone should be able to learn how to tell the computer what to do. She was inspired by the first program she worked on because it was targeted to people who do not have a computer science background. She wanted to help these people grow and learn new skills.

Margarita got involved in developing this new program early on because she was excited about being able to reach thousands of learners and help them grow their skills. She believes that working together with people is important. For this program, she collaborated with a ton of different people, both inside and outside of Google. She got reviews from people and incorporated their ideas into the scripts. She believes that this made the scripts better.

Margarita enjoyed the process of developing this program and is excited to see it come to life. She hopes that the program will help people keep growing and expanding their horizons so that they can reach their full potential.

Here are some key points from the text:

  • Margarita is passionate about teaching programming to everyone.
  • She believes that everyone should be able to learn how to tell the computer what to do.
  • She was inspired by the first program she worked on because it was targeted to people who do not have a computer science background.
  • She got involved in developing this new program early on because she was excited about being able to reach thousands of learners and help them grow their skills.
  • She believes that working together with people is important.
  • She is excited to see this program come to life and hopes that it will help people keep growing and expanding their horizons.

My name is Margarita Manterola. I’m a Site Reliability
Engineer in the G Linux team. I’m very passionate about teaching programming
to everybody. I think it’s very
important that everybody can learn how to tell
the computer what to do. One of the things
that really inspire me about the first
program was that it was targeted to people that were not from a computer
science background. As I myself don’t come from a computer
science background, I felt really identified with
that and I wanted to help all these people keep
growing and keep learning and keep getting
more and more skills. So that’s why I want this program to be
successful as well. I got involved in
developing this program early on because I
was really excited about being able to reach
thousands of learners and being able to help all these people
grow their skills. Working together with
people is really important. For this program, I collaborated with a ton
of different people. From people inside
Google, outside Google. I got reviews from people. I got new ideas. I think it’s really important because it made the
scripts better. The reviewers
suggested new things that should be added
or pointed things that didn’t make sense and I kept
incorporating the ideas into the scripts so that the content delivered
was the best possible. If it had been just me, that wouldn’t have been possible. It’s really important to incorporate many
different points of view. It’s been a lot of work, but I really enjoyed it. I enjoyed the process and it’s really exciting to get
it to come to life. So I hope this program helps
people keep growing and keep expanding their
horizons so that they can reach their full potential.

Quiz: Module 1 Graded Assessment

What is a computer program?

What’s automation?

Which of the following tasks are good candidates for automation? Check all that apply.

What are some characteristics of the Python programming language? Check all that apply.

How does Python compare to other programming languages?

Write a Python script that outputs “Automating with Python is fun!” to the screen.

Fill in the blanks so that the code prints “Yellow is the color of sunshine”.

Keeping in mind there are 86400 seconds per day, write a program that calculates how many seconds there are in a week, if a week is 7 days. Print the result on the screen.
Note: Your result should be in the format of just a number, not a sentence.

Use Python to calculate how many different passwords can be formed with 6 lower case English letters. For a 1 letter password, there would be 26 possibilities. For a 2 letter password, each letter is independent of the other, so there would be 26 times 26 possibilities. Using this information, print the amount of possible passwords that can be formed with 6 letters.

Most hard drives are divided into sectors of 512 bytes each. Our disk has a size of 16 GB. Fill in the blank to calculate how many sectors the disk has. Note: Your result should be in the format of just a number, not a sentence.