Chapter 2 Python
Chapter 2 Python
Chapter 2 Python
class <str>
Rules for defining a Variable name:
A variable name can contain alphabets, digits,
and underscores.
A variable name can only start with an
alphabet and underscore.
A variable name can't start with a digit.
No white space is allowed to be used inside a
variable name.
Examples of a few variable names are:
harry, one8, seven, Seven, etc.
Operators in Python
Following are some common operators in Python:
input() function
input() function in programming. It describes how
this function allows users to take input from the
keyboard as a string.
Key points include:
1.The syntax: a = input("Enter name").
If the user enters "harry", then a will be
"harry".
If the user enters "34", will still be a string
"34".
2.It emphasizes that the output of the input()
function is always a string, even if a number is
entered.
e "31" is a string literal and 31 is a numeric literal
Chapter 2 - Practice Set
1.Write a Python program to add two numbers.