0% found this document useful (0 votes)
2 views

IX Notes(Python)

The document provides an introduction to Python programming, covering fundamental concepts such as programming languages, coding syntax, keywords, identifiers, comments, variables, data types, type conversion, input functions, and conditional statements. It includes fill-in-the-blank exercises, true or false questions, and answers to reinforce learning. Each section is structured to enhance understanding of Python's features and functionalities.

Uploaded by

anvesh592001
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

IX Notes(Python)

The document provides an introduction to Python programming, covering fundamental concepts such as programming languages, coding syntax, keywords, identifiers, comments, variables, data types, type conversion, input functions, and conditional statements. It includes fill-in-the-blank exercises, true or false questions, and answers to reinforce learning. Each section is structured to enhance understanding of Python's features and functionalities.

Uploaded by

anvesh592001
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

PYTHON IX

INTRODUCTION TO PROGRAMMING DAY-1


I. Fill in the blanks
1. Programming is the processes of creating a set of instructions.
2. Computers are electronic devices that perform calculations and processes information.
3. Python is high-level programming language.
4.Programming language is used to write codes that a computer can understand and execute.

II. True or False


1. C# programming language developed by Microsoft.(True)
2. Each programming language can be done on own. (False)
3. Swift is programming language developed by Apple. (True)
4. A computer is a device that takes input, processes it through CPU. (True)
5. Instructions not given to the computer to follow are written using programming language.(False)

III. Answer the following


1. What is a programming?
A. Programming is the process of creating a set of instructions that a computer can understand and
execute.

2. What are type of programming languages?


A. Type of programming languages are: C++,java, Python, JavaScript, C#, Swift.

3. Which is the programming language by Apple?


A. This Programming language developed by Apple is used for developing iOS and macOS.
CODING WITH PYTHON DAY-2
I. Fill in the blanks
1.Python is known for its simple and easy-to-read syntax.
2. Python uses indentation to indicate the structure of the code .
3. Python has wide variety of data types.
4. Python has large and supportive community.
5. Data types can be used to store and manipulate information in your code.

II. True or false.


1. Python can be used for wide range of tasks.(True)
2. We use only IDE for coding Python.(False)
3. In Python , the “print” function is used to give output.(True)
4. The print function in Python is used to display text only.(false)
5. Additionally, Python has several built-in-functions.(True)

III. Answer the following


1.What is a Python?
A. Python is a high-level, interpreted and object-oriented programming language popular for scientific
computing, data analysis and artificial intelligence. It is known for its simple and easy to-read syntax.

2. How is Python versatile?


A. It can be used for a wide range of tasks, from web development to data analysis to artificial
intelligence.

3. What term structures Python code?


A. Python uses indentation to indicate the structure of the code.

4. What is print statement in Python?


A. In python, the ‘print’ function is used to give output text or variables on the screen or on a file.
KEYWORDS AND IDENTIFIERS DAY-3
I. Fill in the blanks
1. In Python, keywords are reserved words.
2. Keywords are used to identify specific operations or structures in the code.
3. In Python, identifiers are the names given to variables.
4. Identifiers cannot start with a number.
5. Identifiers are case sensitive.

II.True or false
1. Identifiers must start with a letter or slash. (False)
2.Identifiers can contain only letters, digits and underscore.(Ture)
3. Identifiers cannot be the same as Python keywords.(True)
4. Identifiers should be descriptive and meaningful.(True)

III. Answer the following


1. What are keywords and identifiers?
A. In Python keywords are reserved words that have a specific meaning in the language and cannot be
used as variable names or function names.

2. What are commonly used keywords and identifiers?


A. The commonly used key words are: false, assert, del, for, in, or, while.

3. What are keywords and identifiers?


A. In summary keywords in Python are reserved words that have specific meaning in the language and
cannot be used as variable names or function names.
COMMENTING IN PYTHON DAY-4
I. Fill in the blanks
1. Comments are ignored by the Python interpreter.
2. Single-line comments start with a hash symbol.
3. Multi-line comments are used to add notes.
4. Comments can also be used to temporarily disable.
5. The are comments namely single-line and multi-line comments.

II. True or false


1. Comments are used to add notes.(True)
2. Comments start and end with triple cotes.(True)
3. There are three types of comments.(False)
4. Comments in Python are considered as errors.(false)
5. It is better to write clear and self explanatory codes .(True)

III. Answer the following


1. What is the use of comments in Python?
A. Commenting in Python is the process of adding explanations and notes to the source code to make it
more readable and easier to understand.

2. How many types of comments in Python and name them?


A. There are two type of comments. Single line and Multiple line comments.

3. Explain Single and Multiple line comments in Python?


A. Single line comments: These comments start with hash symbol (#0 and are used to add notes or
explanations for a single line code.
Multiple line comments: These comments are used to add notes or explanations for multiple lines of
code. They start and end with triple quotes(“ ” ”).
PYTHON VARIABLES DAY-5
I. Fill in the blanks
1. A variable is used to store value.
2. We can store values like numbers and Strings.
3. A Python variable is a memory location.
4. “=” sign is used to assign values.
5. Variable name is known as identifier.

II. True or False.


1. The name of the variable starts with blank space.(False)
2. The variable name cannot have special characters.(True)
3. Variable name Python is not case sensitive.(false)
4. You cannot assign a value to the variable.(false)
5. Python allows you to assign several variable simultaneously.(True)

III. Answer the Following


1. What is a Variable?
A. A variable is used to store value in Python.

2. What is the syntax of a variable?


A. Syntax: variable_name=value

3. What are rules followed while naming a Variable?


A. 1. The name of the variable must start with either a letter or an underscore (_).
2. The name of the variable cannot start with a number.
3. The name of the variable cannot have special character.
4. Variable name is case sensitive.

4. What is creating variables?


A. Python has no command for declaring a variable.

5. Can Python allow to assign single value to several variables, with example?
A. Python allows you assign a single value to several variables simultaneously with the “=” operatot.
Example:-
x=y=z=100
print(x)
print(y)
print(z)
DATA TYPES – I & II DAY-6 & 7
I. Fill in the blanks
1. Data types are used to define the type of a variable or an object.
2. Strings are sequences of Characters.
3. Lists contain items of the different data types.
4. Tuples are enclosed in parentheses.
5. Dictionaries are unordered collections of key pairs.

II. True or False


1. Booleans can have three values.(False)
2. Sets are unordered collections of unique elements.(True)
3. Data types refer to the type of value or variable can hold.(True)
4. Python has no data types.(False)
5.Tuples are immutable(.True)

III. Answer the following


1. What is data type in Python?
A. In computer programming, data types specify the type of data that can be stored inside a variable.

2. What are different types of data types in Python?


A. Data Types are:- Numeric, String, Sequence, Mapping, Boolean, Set.

3. Give examples of various data types in Python, with example?


A. The various data types in Python are:- Strings: Name=”John”
message=”Hello, World1’
Lists: numbers=[1,2,3,4,5]
mixed_list=[1, “Hello”, 3,14,[1,2,3]]

Tuples: cords=93,40
colors=(“red”,”green”,”blue”)

Dictionaries: person={“name”:”John”,”age”:30}
word_count=(“red”,”green”,”blue”)

Boolean: is_active=True
is_valid=False

Sets: fruits={“apple”,”banana”,”orange”}
TYPE CONVERSION DAY-8
I. Fill in the blanks
1. Type conversion is the processes of converting one data type to another.
2. While converting data types value should be compatible with the target data type.
3. Sets and directories are mutable.
4. Tuples and strings are immutable.
5. In Python int(), float(),list(), set(), dict() and bool() are built-in-functions.

II. True or false


1. You can convert a list into tuple.(True)
2. You can convert a tuple to a list using the list() function.(True)
3. You can not convert a dictionary to a set using set() function.(False)
4.You can convert integer to a float() function.(True)
5. You can not convert a string to an integer using the int() function.(false)

III. Answer the following


1. What is type conversion in Python?
a. In Python type conversion is the process of converting one data type to another. This can be done
using built-in functions like int(), float(), str(), list(), tuple(), set(), dict(), and bool().

2. Give examples to convert float(), int(), tuple(), list() and set() function?
A.

Float: x=5 Int: x=”5”


y=float(x) y=int(x)
print(y) print(y)
Output: 5.0 output: 5
Tuple: x=[1,2,3] List : x=(1,2,3)
y=tuple(x) y=list(x)
print(y) print(y)
output: (1,2,3) output; [1,2,3]

Set: x={“a”,1,”b”:2}
y=set(x)
print(y)
output: {‘a’,’b’}
INPUT FUNCTION DAY-9
I. Fill in the blanks
1. In Python the input() function is used to get input from the user.
2. Input() is a built-in function that stops the execution of the program.
3. The entered text will be stored in variable name.
4. It is important to validate the input to avoid injection attacks.
5.To use it to get numeric input by converting the returned string to a numeric data type.

II. True or False


1.Input is a built-in function that continuous the execution of the program.(false)
2. Using input() function user gives value.(True)
3. Input can be given in text or numbers based on variables.(True)
4. It is recommended to validate the input to avoid attacks.(True)
5. The text entered by the user is returned as a string.(True)

III. Answer the following


1. Write a program in Python to get input from the user using input() built-in function and text entered
by the user is returned as a string?
A. name=input(“What’s yout name?”)
print(“Hello.”+name+”I”)

2. Write a program in Python to get integer input?


A. age=int(input(”what is your age?”))
print(“You are”+str(age)+’Years old.”)
CONDITIONAL STATEMENTS DAY-10
I. Fill in the blanks
1. Flow control in Python is used to control the order.
2. In Python conditional statements are used to execute different blocks.
3. “If” statement is used to execute a block of codes only true.
4. “If-else” statement is used to execute one block of codes is true and other block is false based on
condition.
5. The two most commonly used conditional statements are the if and if-else.

II. True or false


1. Flow control in Python the instructions in a program are executed.(True)
2. In Python conditional statements are used to execute the same blocks.(False)
3. The two main conditional statements are “if” and id-else.(True)

III. Answer the following


1. What are conditional statements in Python?
A. In Python, conditional statements are used to execute different blocks of codes based on weather a
certain condition is true or false.

2. What is flow control in Python?


A. Flow control in Python is used to control the order in which the instructions in a program are
executed.

You might also like