0% found this document useful (0 votes)
1 views1 page

11 CS Chapter 6 Notes - Python Fundamentals

Chapter 6 covers Python fundamentals including input and output functions, escape sequences, expressions, statements, variables, dynamic typing, comments, and blocks with indentation. The input() function captures user input, while print() displays output, and special characters are used for formatting. It emphasizes the concept of dynamic typing, where variables can change types without error, and explains the importance of comments and code structure through indentation.

Uploaded by

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

11 CS Chapter 6 Notes - Python Fundamentals

Chapter 6 covers Python fundamentals including input and output functions, escape sequences, expressions, statements, variables, dynamic typing, comments, and blocks with indentation. The input() function captures user input, while print() displays output, and special characters are used for formatting. It emphasizes the concept of dynamic typing, where variables can change types without error, and explains the importance of comments and code structure through indentation.

Uploaded by

anantkrishanp
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Chapter 6

Python Fundamentals
Input in Python
• input() function is used to take input in Python. By default, the value is treated as a text value.
• We can use int() to convert it to an integer, float() to convert it to a floating point number or
complex() to convert it to a complex number.

Output in Python
• print() function is used to display the output in Python.
print('Good Morning')
print('First line\nSecond line\nThird line')
print("St. Stephen's Senior Secondary School")
print('St. Stephen\'s Senior Secondary School')

Escape Sequences - They are special characters which can be used in a print statement.
\n new line \t Tab (horizontal)
\' ' \" " \\ \

Expression - A legal combination of operators and operands.


c=a+b av=(a+b+c)/3 i=p*r*t/100

Statement - An executable line of coding is known as a statement.


print('Hello')
a=int(input('Enter a number '))
c=a*a*a

Variable - They are named memory locations whose values can be manipulated during program
[Link]: a=10 marks=70

Dynamic Typing
A variable is defined by assigning a value to it.
For example x=10 defines a variable which refers to a value of int type.
Later, if we reassign a value of some other type to it, no error is raised. x="Python".
In Python, a variable is treated like a label associated with objects(stored in memory). A variable pointing to
a value of a certain type can be made to point to a value of different type.
This is called Dynamic Typing.

Comments - They are non-executable statements given in the program for explanatory [Link]
provides two types of comments:
• Single line comments– Creating by putting a # sign and then typing the comment.
• Multiple line comments – The lines are to be enclosed within triple quotes. (''')

Blocks and Indentation - A block is a group of statements that is a part of another statement or function.
Blocks are represented through indentation.
if s=='science':
print('Physics')
print('Chemistry')
print('Maths/Bio/[Link].')

You might also like