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

Learn Basics of Coding

I’ve Written a Book for beginners to learn and understand about coding in an illustrated way. This Book mainly focuses Basic Concepts for students to start their coding career.

Uploaded by

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

Learn Basics of Coding

I’ve Written a Book for beginners to learn and understand about coding in an illustrated way. This Book mainly focuses Basic Concepts for students to start their coding career.

Uploaded by

Hanush Singh R
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

With Real life illustrations

Acknowledgement
I would like to take this opportunity to express my heartfelt
gratitude to the following which have played a significant role in the
creation of this “Learn basics of coding” book:

* First and foremost, I want to thank myself for the dedication,


perseverance, and commitment I have shown throughout the process
of writing this book. It is a testament to my passion for coding and
my desire to share knowledge with others.

* I am grateful to my family and friends for their unwavering


support and encouragement. Your belief in me and your
understanding during the countless hours I spent writing and
editing is deeply appreciated.

* I would like to acknowledge the coding community, both online


and offline, for their continuous inspiration and valuable resources.
Your collective knowledge and passion have motivated me to explore
new concepts and techniques in coding.

* I want to express my gratitude to the readers of this book. Your


interest in learning coding and your willingness to embark on this
journey with me are truly humbling. I hope that this book provides
you with valuable insights and helps you in your coding endeavors.

* I extend my thanks to the various coding platforms like


UDEMY.com & Coursera.org.

Specially Thanks to Ishan Sharma (Bitsian, co founder of Markitup)


His contributions have been invaluable in shaping the content of this
book.

Lastly, I would like to acknowledge the power of self-motivation


and self-belief. Writing a book is a challenging endeavor, and it is
my own inner drive and belief in the importance of this topic that
have propelled me forward.
Writing this basic coding book has been a labor of love, and I am
grateful for the opportunity to share my knowledge and passion with
others. Thank you all for being a part of this fulfilling journey.

With sincerest appreciation,


[Hanush Singh R]
Contents
1. What’s Code and How it works ?

(4-5)
2. Introduction and Fundamentals of Programming Languages.

(6-9)

3. How Code powers our daily lives?

(10-12)

4. Working in code: Developers and everyday industries.

(13-16)
5. Basic understanding of C programming language.

(16-17)
Chapter 1
What’s Code and How it works ?

Computers are becoming so embedded into our daily lives it's almost impossible to
imagine a world without them.

But computers would be nothing without the code that tells them what to do.

In this lesson you’ll learn what code is and how coders use it to help the world run
smoothly. You’ll also learn about the World Wide Web, and two coding languages that
make it possible.

What is code?

Code is sets of rules and instructions, written in a specific programming language,


that helps us talk to machines.

Just as humans speak different languages, so do machines. There are hundreds of


programming languages, each suited to different tasks.

Coders are people who understand and work with these languages on a daily basis.

So, what does a coder do? Coders are the architects and builders of the digital
world. They use code to create programs that run on most of the machines you see
and use every day: from laptops to phones, TVs, cars and internet-connected
fridges.

In fact, the device you’re using right now to read this lesson ( ebook ) has a
complex program that makes sure the screen, speakers, microchip and ‘you’ work
together in harmony.

To build these programs, coders write small sequences of tasks that they want the
machines to perform. We call these sequences ‘algorithms’.

For example, cars, have computer programs that monitor all of their systems. An
algorithm within a car’s program could be the following: “If a button is pressed on
the car’s dashboard, make the engine status appear on the screen.”

The amount of code can range from just a thousand lines, which a simple mobile
phone game would need to run, to over 2 billion lines, like the code that powers
Google’s search engine.
Let’s focus on one of the world-changing applications of code: the World
Wide Web.

Did you know the Internet and the Web are actually different things?

In fact, the World Wide Web is just an application that's been built using
the Internet.

Let’s break this down further: the Internet is a global network of


connections between computers that allows them to transfer information
between each other. We use the Internet to send emails, make calls, watch
videos and access the Web through browsers like Chrome, Firefox and
Internet Explorer.

The Web, on the other hand, is a collection of billions of pages of


information that have been made using code. The most well known
programming languages on the Web include HTML (Hypertext Markup
Language) and CSS (Cascading Style Sheets).

Imagine the Internet as a city, with roads and cables connecting


everything and everyone together. Inside this city, the buildings represent
the Web. Some of these buildings are libraries that store information,
some are cinemas where we go to watch films. But all of them are made
out of bricks, or coding languages.

So how do coders use these languages?

Well, when you click on a link or type a web address, you’re actually
asking another computer to send you an HTML file. That file contains the
information your browser needs to display a web page.

Although you immediately see this page of content as visually complete,


your browser actually receives hundreds of lines of HTML code telling it
exactly which text, images, videos and spaces to display, and where.

CSS is an additional coding language that shapes the visual style of a


web page. If HTML defines ‘what’ is displayed, then CSS defines ‘how’ it’s
displayed. It makes sure that colours, fonts, and other style choices are
applied to a web page before you see it. This is useful when working with
lots of HTML pages. Instead of coding the visual style into every single
page, you can just make one master CSS file and link each page to that.

Now that we’ve explored the basics of coding, from computer programs,
to algorithms, to HTML and CSS, it’s time to continue your learning. Try
your hand at writing a bit of code yourself: it’s not as difficult as you
might think.
Chapter 2
Introduction and Fundamentals of
Programming Languages.
The field of coding is constantly evolving to keep up with all of the new
applications, computers and digital devices that are developed every year.
Hundreds of programming languages now exist, with new ones emerging all the
time.
In this lesson we’ll explore why there are so many programming languages, how
these languages are used, and what the future holds for code.
Kotlin, Rust and Julia. No, not the names of pet dogs. These three are just a
tiny example of the number of programming languages available - today, there
are over 250 of them.

So why do we need so many ways to communicate with machines? Why won’t


just one do?

The reason is that it’s much quicker to communicate in languages that are
built for a specific task, rather than to use a generic one for everything. And
as computer programming has evolved, so have the ways that coders build
programmes.

It’s similar to the specialised technical languages that have developed in


different industries. Doctors need specific terms to talk precisely about
patients and medical conditions, just as engineers have a specific language
to communicate about design and materials.

Let’s take a look at the fundamentals of coding in more detail and some of
its most common applications.
The most basic language that computers understand is called ‘binary’. You
might have heard this term before. Binary code is made up of ones and zeros,
and these are the only characters that the language uses. It’s easy for
computers to understand but incredibly difficult for humans. So not even the
best coders write programs using it. Instead, they write in their preferred
programming language and it gets converted into something a machine
understands.

We can categorise different programing languages using something called


‘levels of abstraction’. The lower the level of abstraction, the closer a language
is to the ones and zeros of binary, which is more difficult for humans to
master. And the higher the level of abstraction, the further away it is from
binary, and the easier the language generally is for us humans to use and work
with.

Let’s look at an analogy that will help us to understand what abstraction is.
Imagine you’re designing a house. It’s much faster and easier to draw a basic
sketch, outlining the shape, the materials, and the fittings, than it is to go into
detail about every nail, brick, and plank of wood. As long as you communicate
the essence of that house, the architects and builders will fill in the gaps.

The basic sketch is equivalent to ‘high-abstraction’, or a high-level


programming language. It’s still the house, but a simplified representation of
it. A high-resolution model or a detailed set of blueprints for the house
would be the equivalent of ‘low-abstraction’, or a low-level programming
language. While this offers a much more comprehensive representation, it’s
also far harder and more labour-intensive to design.
Let’s look at some languages at a low-level of abstraction:

‘C’ and ‘Assembly’: Computers can understand them relatively easily. This
means they can translate the code very quickly and they don't need much
memory power to run programs. This makes ‘C’ and ‘Assembly’ perfect for
building smaller computers that tell devices such as cars, digital watches,
thermostats and traffic lights how to work.
Languages like “C++” and “Swift” are written at a higher level of abstraction.
These are easier for people to work with, but a little resource intensive for
machines to read. Coders use these languages to build things like the mobile,
tablet, and desktop apps that you use on a daily basis. These languages are
really versatile as they need to perform lots of different tasks.

Managing data is another important application of coding, as the amount of


data we produce on the planet increases. Coders use higher-level languages
like “SQL” (pronounced “sequel”) to capture, store, analyse and sort that data in
lots of different ways.

If you look at how a social network application is coded, then behind the
photos, updates, and likes is a huge database that securely stores data from its
millions of users. By manipulating the data with SQL, social networks can
recommend friends, target ads, and show you relevant content.
But, the most commonly used programming
language in the world is "JavaScript". Whenever
you're on a web page and you see a game,
interactive chart, or lots of moving elements,
you're seeing JavaScript at work. In fact, 95% of
the 10 million most popular web pages use it.
JavaScript is a 'scripting' programming
language, which is a family of languages
designed to be as friendly as possible for
coders.

Now that we’ve explored some of the applications of code, take some time to
research the computer programs you use on a daily basis. Put on your detective
hat and search online to see which languages were used to build them, and
what’s happening behind the scenes.

To wrap up, there are many programming languages out there, each used to
achieve different goals. A mix of low, mid and high level languages enable
coders to write for a range of purposes, whether it’s C and Assembly to program
smaller computers and devices, or SQL and JavaScript to manage databases, and
JavaScript for bringing interactivity to websites.

Regardless of the language, the goal of programming is always the same: to


instruct a computer to complete a specific task that will help you to do things
faster, easier, and more effectively.
Chapter 3
How Code powers our daily lives?
In the last few decades computers have become smaller, faster and
cheaper. They are now everywhere, from your phone to your fridge,
helping us to communicate, do business and get around.
In this lesson we’ll explore how computers integrate with our daily lives,
and how code is used to help program the innovative technologies
popular today.

Almost all companies now use digital systems to conduct their day-to-
day business. They use advanced accounting software for smart
bookkeeping; teams communicate by email, messaging, or video
conference; vendors track sales through sensors and databases; and often
retailers sell products that only exist in the digital world.

In the last 50 years the speed and size of computer microchips has
changed massively. The computers that put a man on the moon cost $3.5
million and were the size of a car. Today, the average smartphone is 12
million times faster and fits in your pocket.

This small, inexpensive technology is now everywhere: toasters, cars,


medical devices, clothing. And much of it is connected to the Internet.
Coders can use sets of functions and procedures called APIs (application
programming interfaces) to help two computer applications talk to each
other.
Let’s explore a few everyday examples of how computers use APIs to make life
simpler for us.

ATMs use APIs connected to banks all over the world to check how much money
you have in your account. If you want to get money out in Paris, the ATM program
quickly contacts your bank in London, deducts the amount off your balance,
transfers it to the ATM company, and you get your cash. All in a few seconds, and
all because of APIs.

When you book a hotel room through a centralised booking site, like
Booking.com, you are relying on an API that connects the booking form with
room tracking systems in thousands of hotels all over the world. If the hotel
tells the booking site they have a free room, you can book away!

Music streaming applications like Spotify track which songs are being played the
most across the world. They use this data to automatically generate playlists that
feature the most popular artists and songs, often tailored specifically to your
musical tastes.

Using APIs, programs can communicate with each other, which in turn helps us to
complete tasks faster and more efficiently in our daily lives and in the
workplace.
The world of code is constantly evolving. Let’s briefly look at two important
trends in technology that are shaping how people code: artificial intelligence and
machine learning.

Artificial intelligence and machine learning are both branches of computer science,
and both contribute to the development of machines being able to make smarter
decisions.

Artificial intelligence, or AI, is the science of making machines intelligent. AI is


already helping improve our day-to-day lives: from smartphone assistance and the
technology that detects credit card fraud, to smart thermostats like Nest that
automatically adjust room temperatures based on your habits and schedule.

Machine learning is a technique used to further develop AI. Machine learning


programs identify patterns, make predictions, and learn from examples, without
being explicitly programmed to do so. We already benefit from machine learning
in many situations: from predicting traffic patterns, recognising faces in photo
libraries, and translating foreign languages.
To put these two together: AI takes what machine learning has learnt from its
environment and uses it to make intelligent decisions. Artificial intelligence
and machine learning are also being used on larger scales:
for example,

Farmers use it to sort vegetables into different sizes and qualities;


scientists use it to track the movement of animals; and medical researchers
are using it to detect the emergence of different cancers.

These exciting new technologies are providing us with new ways of looking at
old problems, and are helping to transform the way coders can shape the
digital and physical worlds.

So that was a brief introduction to some of the ways code affects our
everyday lives. Take a look around your home, or your workplace.

Which devices are connected to the internet?

What APIs are they gathering their data from?

Is there anything around you that’s already using AI or machine


learning?

And if not, what around you do you think could benefit from these
technologies?
Chapter 4
Working in code: Developers &
everyday industries
Today’s industries are becoming more and more reliant on digital technologies
to succeed. But whilst code is what powers the work we do on a daily basis, most
of us are only just beginning to harness its full potential.

In this lesson you’ll learn why code is important in the modern workplace, and why almost
everyone can benefit from having a basic understanding of code.

Most technologies emerge to satisfy specific human needs. Ancient hunter


gatherers needed tools to help them grow crops and prepare them for eating: so
they invented sickles to cut the wheat. The same is true with digital technologies.
Tools like Microsoft Word and Google Docs were invented to help us write, edit,
and share information faster. Video conferencing applications like Skype were
invented to improve long-distance communication.

Today, many manual and repetitive tasks are automated. This has led to massive
increases in efficiency and the numbers of new products and services. In an
ideal world, we would let computers do things they’re good at, leaving humans to
do the things we’re good at.

For example,
machine learning allows computers to complete regular tasks in an ever-more
efficient way, by automatically learning what works best from past experiences.
The rapid changes in the world of digital technology means jobs we can't even
imagine today will be created. So to stay ahead in the modern workplace we
need to learn how to work with these new coding languages, devices, and
applications, and use them to enhance our own productivity.

Let’s look at a few jobs that have coding at their core.

Mobile Developers use programming languages like Java and Swift to make the
apps and games you use on your phone. Since the Apple and Google app stores
were launched 10 years ago, the world of apps has enjoyed enormous popularity.
There are now millions to choose from, no matter what kind of smartphone you
have.

Data Scientists use code to gather, analyse and understand massive amounts of
data. They are becoming increasingly in demand as companies look for experts
to help their teams make smarter business decisions. By using data and evidence,
teams can understand the real cost or benefit of different choices - from the
value of placing an advertisement, to a breakdown of the time that’s spent on
different business activities.
System Administrators are the mechanics of the digital world. They often work in
larger companies making sure that their complex computer systems are
configured properly and working effectively. Most are highly skilled
professionals, often required to look after both the digital software and the
physical hardware.

And finally, Robot Programmers of course use code on a daily basis make all
sorts of robots work. Within the manufacturing industry, robots are everywhere,
and they all need to be programmed with maneuvering and decision-making
capabilities to do their jobs properly. Some robots put out fires, some explore
outer space, and others build cars on assembly lines.

These are just four examples of jobs that utilise coding, but there are
hundreds and hundreds of others out there, in almost every industry. And as
code becomes increasingly important, so will the jobs that utilise it.

In addition to full-time coding roles, some jobs also utilise code alongside
their day-to-day work, despite not explicitly being coding jobs. Here are a few

examples:
Researchers, journalists, and marketers now use task automation tools like If
This Then That and Zapier to make the laborious task of collecting data from
multiple sources much easier. With just a few clicks, they can set up these apps
to collate information from multiple web pages, post across multiple social
media accounts, or notify them when their name is mentioned online.

Designers, art directors and other creative professionals can benefit from basic
coding knowledge too. Where once they would have been limited to a
relatively static and constrained medium, they now can use code to explore
new ways to express ideas and create experiences.
Last but not least, engineers in many fields often write computer programs
to help test and design their creations - from fine-tuning car dashboards,
to simulating passenger movement at airports. Whilst most of their time is
spent completing engineering work, many of them now need a basic
understanding of a coding language like Python to keep up in their field.

Now you know a bit more about code in the world of work, do a little
research into the industry you work in, or another one that interests you.

What new technologies are being developed that might change the way you
work?

What exciting opportunities are there on the horizon?

With the world changing faster than ever, it pays to stay ahead of the curve
Chapter 5
Basic Understanding of C language
Learning everything about the C language is a vast undertaking, but I can
break it down into several sub-topics and explain each one in a simple
manner. I will provide examples and anecdotes to help you understand,
and I'll also ask you questions to test your understanding. Once you submit
your answer, I'll identify any mistakes and provide feedback. Let's begin!

Sub-topic 1: Introduction to C Language

Explanation: The C language is a popular programming language known for


its simplicity and efficiency. It was developed in the 1970s and has since
become widely used in various applications, including system programming,
embedded systems, and game development.
Example: Here's a simple "Hello, World!" program in C:

#include <stdio.h>

int main() {
printf("Hello, World!");
return 0;
}

Question: What is the purpose of the #include <stdio.h> line in the above
code?
Feedback: The #include <stdio.h> line is a preprocessor directive that
includes the standard input/output library, which contains functions like
printf() for displaying output. Good job!

Next, let's move on to the next sub-topic.

Sub-topic 2: Variables and Data Types in C

Explanation: Variables are used to store data in a program, and data types
define the kind of data that can be stored. C provides various built-in data
types, such as int for integers, float for floating-point numbers, and char
for individual characters.
Example: Here's an example that declares and uses variables of different
data types:
#include <stdio.h>

int main() {
int age = 25;
float height = 1.75;
char grade = 'A';

printf("I am %d years old.\n", age);


printf("I am %.2f meters tall.\n", height);
printf("My grade is %c.\n", grade);

return 0;
}

Question: What is the data type of the variable grade in the above code?
Feedback: The data type of the variable grade is char. Well done!
Now, let's move on to the next sub-topic.

Sub-topic 3: Control Flow in C

Explanation: Control flow statements allow you to control the execution of


your program. C provides various control flow statements, including
conditional statements (if, else if, else), loops (for, while, do-while), and switch
statements.
Example: Here's an example that uses conditional statements to determine the
grade based on a student's score:

#include <stdio.h>

int main() {
int score = 85;

if (score >= 90) { Question: What will be the


printf("Grade: A\n"); output if the score variable is
} set to 78 in the above code?
else if (score >= 80) {
printf("Grade: B\n"); Feedback: If the score variable
} is set to 78, the output will be
else if (score >= 70) { "Grade: C." Great job!
printf("Grade: C\n");
} This concludes the explanation
else { for the first three sub-topics
printf("Grade: F\n");
}

return 0;
}
I am writing this letter to express my deepest gratitude for
your support and for choosing to read my book, Learn
Basics of Coding.

Your decision to invest your time and attention in my work


means a great deal to me, and I am truly honored.
I am thrilled to hear that you found value and enjoyment in
its pages.
It is my sincerest hope that the book has provided you with
valuable reading experience about coding.

In addition to writing this book, I have a YouTube channel


where I share related content, delve deeper into the topics
covered in the book, and explore new ideas. I would be
delighted if you could take a moment to subscribe to my
channel [Hanush Singh R].

By subscribing to my channel, you will be among the first to


receive notifications about new videos, gain access to
exclusive content, and be part of a vibrant community of
like-minded individuals who are passionate about the
subjects covered in the book.

Your support as a reader is invaluable, and I would be


immensely grateful to have you as a subscriber on my
YouTube channel as well. Together, we can continue the
journey of learning, growth, and inspiration.

Thank you once again for choosing to read my book and


for considering subscribing to my YouTube channel. Your
support means everything to me, and I am excited to embark
on this journey together.
Warmest regards,
[Hanush Singh R]
[ https://youtube.com/@HanushSinghR]
To Contact mail to hanushsinghr@gmail.com

You might also like