Python Notes Class VI Rev
Python Notes Class VI Rev
Python supports Unicode, which means it can handle characters from different
languages and scripts.
You can use a wide range of characters in your Python code, including letters,
numbers, symbols, and even emojis.
Variables:
Variables are used to store data in Python.
You can assign a value to a variable using the assignment operator (=).
Variable names must start with a letter or an underscore (_), followed by letters,
numbers, or underscores.
Example:
x = 10
name = "John"
Data Types:-
Data types in Python are classifications for data objects that are based on their
characteristics and behavior. They determine the type of values that variables
can hold and the operations that can be performed on those values.
Python has several built-in data types:
o Numeric: int (integer), float (floating-point number), complex (complex
number)
o String: str (sequence of characters)
Input function:
The input() function is used to take input from the user.
It takes an optional prompt string as an argument, which is displayed to the user.
The input function always returns a string.
name = input("What is your name? ")
print("Hello,", name)
Print function:
The print() function is used to display output on the console.
It can take multiple arguments, which are printed separated by spaces.
The end parameter can be used to specify a different ending character (default is
a newline).
The sep parameter can be used to specify a different separator between
arguments (default is a space).
print("Hello", "World")
OPERATORS –
In Python, operators are special symbols that perform operations on values and
variables. They allow you to manipulate data, perform calculations, make
comparisons, and more.
Exercise
1.Which of the following is true for variable names in Python?
a) underscore and ampersand are the only two special characters allowed
b) unlimited length
c) all private members must have leading and trailing underscores
d) none of the mentioned
2.Who developed Python Programming Language?
a) Wick van Rossum
b) RasmusLerdorf
c) Guido van Rossum
d) NieneStom
3.In which year was the Python language developed?
a) 1995
b) 1972
c) 1981
d) 1989
4.Which one of the following is the correct extension of the Python file?
a) .py
b) .python
c) .p
d) None of these
5.In which year was the Python 3.0 version developed?
a) 2008
b) 2000
c) 2010
d) 2005
1. The print function can only print literal values. (False)
2. Variables change their value over time according to the instruction in a
program.(True)
3. Variables in Python are used to solve for unknown values, like in Algebra.
(False)
4. Normally, statements are executed from top to bottom. (True)
5. Expressions are always evaluated from left to right.(False)
1. What is python ?