DAY 1-Intro-DT-var
DAY 1-Intro-DT-var
2 Programmers are highly trained Coders are developers with a lower level
individuals who use logic to solve of skill.
complicated issues.
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
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
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
input (expression)
Example 1:
interpreter.
Types of Comments in Python
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