0% found this document useful (0 votes)
6 views27 pages

DAY 1-Intro-DT-var

The document outlines the differences between coding and programming, emphasizing that programming involves developing software while coding translates human language into binary. It introduces basic programming concepts in Python, including keywords, identifiers, data types, variables, and input/output operations. Additionally, it explains how to use comments and the print function in Python to enhance code readability and output.

Uploaded by

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

DAY 1-Intro-DT-var

The document outlines the differences between coding and programming, emphasizing that programming involves developing software while coding translates human language into binary. It introduces basic programming concepts in Python, including keywords, identifiers, data types, variables, and input/output operations. Additionally, it explains how to use comments and the print function in Python to enhance code readability and output.

Uploaded by

ashlynlourdu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 27

Welcome

Python Intern Training


-NextGen
Difference B/W coding and
programming
S.N Programming Coding
o
1 Programming is the method of Coding is the process of translating
developing full-fledged software. normal language (like we humans
communicate) into binary language.
(language of 1 and 0) which is
understandable by the computer.

2 Programmers are highly trained Coders are developers with a lower level
individuals who use logic to solve of skill.
complicated issues.

3 Programming necessitates a Code may be written without any prior


rigorous and comprehensive preparation, and a basic solution can be
approach. As a programmer, your created in a matter of hours. It is
aim will generally take between a frequently accomplished by trial and
few weeks and a few months to error.
achieve.
What is Program?
 A program is a set of instructions or
commands written in a programming
language that tells a computer how to
perform a specific task or solve a problem.
 It's a sequence of steps designed to

achieve a particular goal by manipulating


data, performing calculations, controlling
hardware, or executing specific actions.
How computer write the
instructions?
 Algorithm: An Algorithm is an outline of how a program
should work.
 Procedure /Method/Function : Different languages use
different words but all mean the same.
 Example: the series of steps required to make a cup of
tea represents a program. Each step outlines a specific
action necessary to achieve the goal of making a cup of
tea.
 Just as these instructions guide someone in making tea
by breaking down the process into manageable steps, a
computer program similarly consists of instructions that
guide a computer or system on what actions to perform
to achieve a specific result or solve a particular problem.
Basic Concepts of Python
 Keywords and Identifiers
 Data types
 Variable
 Input/output
 Operators
 Functions

Example:
Int a, float b,
a= 10
b=20.08
c=a+b
Print(c)
Keywords
 Keywords are predefined, reserved words
used in Python programming that have
special meanings to the compiler.
 We cannot use a keyword as a variable

name, function name, or any other


identifier. They are used to define the
syntax and structure of the Python
language.
IDENTIFIERS
 Identifiers are the name given to variables,
classes, methods, etc.
 Example: language = 'Python'
 We cannot use keywords as variable names

as they are reserved names that are built-in


to Python.
 Example: continue = 'Python'
Variables:
 A variable can be thought of as a memory
location that can hold values of a specific
type.
 In programming, a variable is a container

(storage area) to hold data.


 we use the assignment operator = to assign a

value to a variable.
 Example:

a=10
Print(a)
Where a is the variable, where 10 is stored in a.
Rules for Naming Python
Variables
 Constant and variable names should have a
combination of letters in lowercase (a to z) or
uppercase (A to Z) or digits (0 to 9) or an
underscore (_)
 If you want to create a variable name having

two words, use underscore to separate them.


 Python is case-sensitive.

So num and Num are different variables.


 Avoid using keywords like if, True, class, etc.

as variable names.
DATA TYPES
 Data Types are used to define the type of a
variable. It defines what type of data we are
going to store in a variable.
 The data stored in memory can be of many

types.
 For example, a person's age is stored as a

numeric value and his or her address is


stored as alphanumeric characters.
 Some of the data types are int, str,float.
Input and Output
Operations
 A Program needs to interact with the
user to accomplish the desired task;
this is done using Input-Output facility.
Input means the data entered by the
user of the program. In python, we
have input() function.
 Syntax:

input (expression)
Example 1:

# python input operations


# user input
x = input("Enter any value: ")
# printing value
print("Entered value is: ", x)
OUTPUT
Example 2:
# Input: Asking for the user's name
name = input("Enter your name: ")

# Output: Greeting the user


print("Hello,", name)

# Input: Asking for the user's age


age = input("Enter your age: ")

# Output: Displaying the user's age


print("You are", age, "years old.")
OUTPUT
Python Comments
 In computer programming, comments are
hints that we use to make our code more
understandable.
 Comments are completely ignored by the

interpreter.
 Types of Comments in Python

In Python, there are two types of comments:


 single-line comment
 multi-line comment
Python Comments Example
# create a variable
name = 'Eric Cartman'
# print the value
print(name)

# This is a long comment


# and it extends
# to multiple lines

''' This is also a


perfect example of
multi-line comments '''
Different types of input
 a=5
 b=10
 c=”hello”
 d=’a’
 e=10.25
 x=int(input())
 y=float(input())
print() function/statement
 print evaluates the expression before printing
it on the monitor. Print statement outputs an
entire (complete) line and then goes to next
line for subsequent output (s). To print more
than one item on a single line, comma (,)
may be used.
 print() function is a library function in Python,

it is used to print the value of the given


arguments (objects) to the standard output
stream i.e. to print it on the screen.
 Syntax:

print(expression/constant/variable)
Example 1:
print('Hello!')
print('How are you?')
print("Hello!")
print("How are you?")
print('''Hello!''')
print('''How are you?''')
OUTPUT
Example 2:
# print() example in Python
# printing values
print(10)
print(10.2345)
print([10, 20, 30, 40, 50])
print({10, 20, 30, 40, 50})
a = 10 # printing an integer
b = 10.2345 # printing a float
c = [10, 20, 30, 40, 50] # printing a list
d = {10, 20, 30, 40, 50} # printing a set
OUTPUT
Example 2:
# print() example in Python
# printing values
print(10)
print(10.2345)
print([10, 20, 30, 40, 50])
print({10, 20, 30, 40, 50})
a = 10 # printing an integer
b = 10.2345 # printing a float
c = [10, 20, 30, 40, 50] # printing a list
d = {10, 20, 30, 40, 50} # printing a set
basic examples demonstrating the
print() statement in Python:
Printing Strings
print("Hello, world!") # Prints a simple string
Printing Variables
name = "Alice"
age = 30
print("Name:", name) # Prints a string and
variable value
print("Age:", age)
basic examples demonstrating the
print() statement in Python:
Concatenating Strings
first_name = "John"
last_name = "Doe“
Num=3
print("Full Name:", first_name + " " + last_name)
Print(‘ I love number’+str(3))
# Concatenates strings
Multiple Arguments
fruit1 = "Apples"
fruit2 = "Oranges"
fruit3 = "Bananas"
print(fruit1, fruit2, fruit3) # Prints multiple arguments separated by
space
print(fruit1, fruit2, fruit3, sep=", ") # Custom separator between
arguments

You might also like