A Note from Deputy Commissioner, KVS Delhi Region It is an established fact that the computer education in school plays an important role in overall development of students. Computer with an internet access is the most powerful weapon, which opens the doorway of all information, knowledge and skill available in this universe. However, there was a definite syllabus but in the absence of any study material transaction of the computer literacy as a subject was limited to the imagination of the teacher. With the advent of new era of artificial intelligence, it is need of the time to introduce technology and coding at an early stage to students, in a uniformed and standard way. In our endeavour to help students become better equipped and confident, we have taken the initiative to develop syllabi and textbooks which touch all the paradigm of teaching ICT in well directed manner. This book series for class 3 to 8 has been developed with efforts of many teachers and contributions from academicians of KVS Delhi Region. It is based on detailed computer literacy syllabus as per CCE(RTE) and all applications taught are based on free and open source software. The lesson is based on interaction between two students from primary classes to encourage auto didacticism and to teach them how to think and improve problem solving. We have focused on content and skills to lay a strong foundation for learning computers. The accomplishment of this venture depends on the cooperation of all principals and teachers who will encourage children, guide them and help them at different steps and give them infrastructure and proper guidance to use this Book. Comments on the book and suggestions for next edition are most welcome and may be sent to [email protected]. (Nagendra Goyal) Deputy Commissioner
ACKNOWLEDGEMENT I hereby acknowledge the contribution and counsel of Smt. Poonam Mallik, Assistant Commissioner (KVS Delhi Region) as Chief Coordinator with Content Development Team and Sh. Sanjit Kumar, Assistant Commissioner (KVS Delhi Region), Smt. Shilbala Singh, Assistant Commissioner (KVS Delhi Region) for their regular support and inputs during various meetings. I also acknowledge the efforts of Mr. Pravin Kumar, Administrative Officer (KVS Delhi Region) and Ms. Shivani Suneja, Finance Officer (KVS Delhi Region) for helping in Printing and Publishing. I gratefully acknowledge the contribution and determination of Ms Monika Batra, Vice Principal, Kendriya Vidyalaya Janakpuri as Regional Coordinator and coauthor and the authors - Mr. Nitin Aviral, KV Tagore Garden, Ms Manpreet Kaur, PGT CS KV Janak Puri, Ms. Kanchan Khurana, PGT CS, KV Sainik Vihar, Mr. Narender Kumar, PGT CS Sec 8 R K Puram in content development. The contributions of Mr Rajnish (VP), Kendriya Vidyalaya Delhi Cantt No 1 and Ms. Ramandeep Kaur, TGT Eng, KV Delhi Cantt 3. are acknowledged for reviewing the manuscript of the series. The untiring efforts of Ms Monika Batra, (VP), Kendriya Vidyalaya Janakpuri, Mr. Avdhesh Kumar Lawania, PRT, KV JNU, NCERT Br. for formatting, editing, compilation and final review is highly acknowledged. Finally, with great pleasure, I acknowledge the contribution of Master Ansh Kumar, Class XII B (Session - 2020-21), KV Janak Puri for book cover and graphics (Gowri and Aryan). (Nagendra Goyal) Deputy Commissioner THIS BOOK, OR ANY PART THEREOF, MAY NOT BE REPRODUCED IN ANY FORM WITHOUT THE WRITTEN PERMISSION OF OWNER.
KVS DELHI REGION 2021 CLASS 7 TABLE OF CONTENTS SL.NO. UNITS PAGE NUMBER 1 CODE -DECODE 1 2 PYTHON 5 3 PYTHON PROGRAMMING 22 4 INTRODUCTION OF GIMP 31 5 MORE ABOUT GIMP 41 6 MORE APPLICATION OF INTERNET 56 7 COMPUTER SECURITY 64 8 APPENDIX I (ANSWERS) 72 Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
KVS DELHI REGION 2021 SYLLABUS CLASS 7 Quarter - APRIL to JUNE Sl.No. Units Contents 1 Code -Decode 1.1 Coding 1.2 Decoding 1.3 Puzzle Test 2 Python 2.1 Concept of Coding? 2.1.1 Algorithm & Flowchart 2.1.2 Understanding Flowchart Symbols 2.1.3 Developing Flowchart 2.2 Python -An Introduction 2.3 Python Installation 2.4 Python Basics 2.5 Operators in Python Quarter - July to September 3 Python Programming 3.1 Basic Programming 3.1.1 Writing and compiling a Program 3.1.2 Creating First Program 3.1.3 Understanding print() 3.1.4 To do Simple Programs 3.2 Python Programming – Decision Structure 3.2.1 Inputting Values 3.2.2 Decision Structure 3.2.3 Practice 4 Introduction Of GIMP 4.1 Introduction to GIMP. 4.2 Gimp features 4.3 How to download GIMP 4.4 Gimp file formats 4.5 Let us start gimp Quarter - October to December 5 More About GIMP 5.1 Gimp components 5.2 Image editing in gimp 5.3 Gimp web image 5.4 How to crop image 5.5 How to make circle shaped image. 5.6 How to create a text logo in GIMP Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
KVS DELHI REGION 2021 6 More Application Of Internet 6.1 Internet of Things (IoT) 6.2 Online collaboration 6.3 Google Sheet 6.4 Cloud Computing Quarter - January to March 7 Computer Security 7.1 Threats to computer 7.2 How to protect your system 7.3 Anti-Virus software and examples 7.4 Firewall and its use 7.5 Cyber Crime and Computer Ethics 7.6 Hackers and crackers 7.7 Cyber law and importance 7.8 Backup and Restore Project Projects —in Python Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 2 KVS DELHI REGION 2021 Example 2: In certain code language, EASY is written as ‘5117’. In the same code language, how will ‘BEAM’ be written as? a. 4512 b. 2514 c. 4567 d. 2513 Solution: Remember this table: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 EASY → E is the 5th alphabet in the series A is the first alphabet in the series S is the 19th alphabet, which makes it (1+9 = 10 ⇒ 1+0 = 1) Y is the 25th alphabet, which makes it (2+5 = 7) Hence, EASY = 5117 Similarly, BEAM → B is the 2nd alphabet in the series E is the 5th alphabet in the series A is the 1st alphabet in the series M is the 13th alphabet, which makes it (1+3 = 4) Hence BEAM = 2514 Option b is correct. Example 3: In certain code language, ‘NEWS’ is written as &5%1, then ‘ASLE’ is coded as: a. $@*# b. 5123 c. @1&5 d. 5*1# Solution: On observation, it is clear that first and third letter are coded as symbol and second and fourth letter are coded by numbers. The code of E and S are 5 and 1 respectively where as first and third character must be symbol. In all four options, c option is correctly coded. Something to Do Q1. If ‘BEAT’ is coded as ‘ADZS’, then how will you code ‘TRACE’? a. USBDF b. SQZBD c. SQABD d. SQZDE Q2. In certain code, CLOCK is coded as KCOLC, how is STEPs coded in that code? a. SPETS b. SPSET c. SPEST d. STEPS Q3. If HEALTH is coded as GDZKSG, then code for NORTH is a. OPSUI b. GSQMN c. FRPML d. MNQSG Q4. If the code of AMONG is BKRJL, then the code of SLEEP is a. LEPSE b. TGHAU c. TMFGQ d. TJGBU Q5. If BAKE is coded as 5796 and FIRE is coded as 3146, then FEAR is coded as a. 6374 b. 3674 c. 4763 d. 6347 Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 3 KVS DELHI REGION 2021 Q6. In certain code language, PAIR is written as ‘7199’. In the same code language, how will ‘FAIR’ be written as: a. 6919 b. 1691 c. 6919 d. 6199 Q7. If BRAIN is coded as 29195, the how is SLEEP coded in that code. a. 13557 b. 15357 c. 31557 d. 35517 Q8. If 1352 is coded as DEAR and 2693 is coded as ROPE, then 93 52 is coded as a. ARPE b. RAEP c. PEAR d. ERPA Q9. If RAID is written as %#@$ and RIPE is coded as %@^*, then DEAR is coded as a. $*#% b. *#%$ c. $%*# d. #%$* Q10. If STAR is coded as #8@7, then JRKT is coded as a. *789 b. *7%8 c. %8*9 d. %7*# 1.3 Puzzle Test: Puzzle is a program in which the information is given in a confusing and jumbled manner. Many a times, only a part of the whole information is given and you are required to fill in the missing links in the given information. Example 1: Four children P, Q, R and S sitting on a bench. P is to the left of R and Q is third right of S. Who is sitting at extreme right end? Therefore, from above sitting arrangement it is clear that Q is sitting at extreme right position. Something to Do Q1. Read the following information carefully and answers the questions given below: Six students A, B, D, C, D, E and F are sitting in two rows, three in each. E is not at the end of any row. D is second to the left of F. C, the neighbor of E, is sitting diagonally opposite to D. B is the neighbor of E (i) Which of the following sitting diagonally opposite each other? a. F and C b. A and C c. D and A d. A and F (ii) Who is facing B? a. A b. C c. D d. E (iii) Which of the following are in the same row? a. A and E b. E and D c. C and B d. A and B S P R Q Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 4 KVS DELHI REGION 2021 Q2. Read the following information carefully and answers the questions given below. Six friends A, B, C, D, E and F are sitting in a circle facing the centre. A is between B and E. C is between D and F. E is to the immediate right of D. (i) Who is between E and C? a. D b. B c. A d. F (ii) Who is immediate right of A? a. B b. D c. E d. C Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 5 KVS DELHI REGION 2021 2. Python 2.1 Concept of Coding: Dear students, have you ever thought about the games you played either online or on your mobile. Have you thought about who and how these games were developed? What works behind it? Definitely, some process/functioning must be there to do all these developments. You know a computer is an electronic device and it works on the basis of instructions written by someone. These instructions are written in special languages which are easily understandable by computers as well as humans. These languages are known as Programming languages. To develop games and other beneficial programs, one needs to learn computer programming language. Some of the popular programming languages are Python, C#, C++, JAVA etc. Coding is the process of writing code (instructions) in a programming language to resolve some problem/ create games / developing software/ creating websites etc. Before going into the details of coding, let’s take an activity where you are planning to celebrate a birthday party with your friends. Write steps for the preparation of the party. 1. Invitation 2. Order a Cake 3. Decoration of Party Place 4. Snacks & Sweets Arrangement What you observed in the above activity? Have you seen that there is a definite order of activities and if you planned it well then you will enjoy your party without any nuance and worry. In case of improper planning this event would not be successful. 2.1 Concept of Coding? 2.1.1 Flowchart & Algorithm 2.1.2 Understanding Flowchart Symbols 2.1.3 Developing Flowchart 2.2 Python -An Introduction 2.3 Python Installation 2.4 Python Basics 2.5 Operators in Python Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 6 KVS DELHI REGION 2021 In computer coding, whenever you want to write programs to solve real life problems/games, first of all you need to plan your activity on paper. After developing a layout on paper, you can proceed to develop programs. To do planning of these programs, we use certain tools like flowchart, algorithm, etc. Let’s take a look at these tools in the upcoming section. These tools help us to draw a layout of solution of problem before converting it into a computer-based program. 2.1.1 Algorithm & Flowchart Algorithm: Algorithm is the process of writing all the steps required to solve a particular problem. These steps are written in English language to describe each statement. To develop an algorithm following steps are required: 1. Read problem definition 2. Analyze the problem to identify Input, Output and Process 3. Develop an algorithm 4. Refine by adding more details 5. Review the developed algorithm Let’s understand what algorithms do we use in our daily life? Problem: To prepare grilled sandwich Input: Bread, mayonnaise, Chopped Veg, butter Process: 1. Prepare filling and fill it 2. Spread butter 3. Put raw sandwich in the griller. Output: Grilled Sandwich We can see in the above example, grilled sandwich making has a predefined order of instructions to prepare it. It’s a simple algorithm. For more complex programs like sending missiles, finding routes on a map etc we need to develop complex algorithms. Another Flowchart : Flowchart is a pictorial representation of steps involved in the solution of a problem. Flowchart is easier to understand as it depicts the solution graphically. 2.1.2 Understanding Flowchart Symbols To draw a flowchart, following symbols are used for various purposes. Start /Stop Input / Output Process Decision Box Flow line Connector Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 9 KVS DELHI REGION 2021 C. Match the following: A B a. Used to depict process visually 1. Terminator b. As easy to write in English 2. Coding c. Used to develop a is a computerized solution of a problem 3. Flowchart d. start/stop of a program is known as 4. Algorithm e. It is a process of creating computerized solution of a problem 5. Python D. Select the correct answer for each question: 1. The ………………. is a convenient tool to represent the flow of control in a program? a. Algorithm b. Flowchart c. Decision Chart d. None 2. In a flowchart, a process is represented by: a. A rhombus b. A circle c. A rectangle d. A parallelogram 3. What should be considered when designing an algorithm? a. if the correct hardware is being used b. if the correct software is being used c. if there is more than one way of solving the problem 4. What shape represents the start and End of a flowchart? a. Oval b. Rectangle c. Diamond d. Square 5. Which of the following symbol is used to mark a question/decision in flowchart? a. b. c. d. E. State True or False 1. Programming languages give instruction to computer. 2. The order of the instructions is very important when you write an algorithm. 3. We can’t develop algorithm without using computer. 4. Flowchart is a type of graphical diagram that represents an algorithm. 5. Data flow in flowchart is represented through diamond symbol. Something to Do: 1. Write an algorithm to prepare a cup of tea. 2. Draw a flowchart to display the area of a rectangle. 3. Draw a flowchart to find whether the inputted number is greater than 5 or not. Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 1 2 KVS DELHI REGION 2021 Step 1: Open browser and type www.python.org . Download Installer file. Step 2: Run downloaded executable file. Click on Install now to install python at the default path or customize installation option is used to define installation folder. Default path is App Data/directory of the current user. Install launcher for all users means every user on this machine has access to the python. Step 3: Getting Python Prompt Once your installation is over, you can open the python program from start menu in Windows. Python IDLE icon will appear in the start menu, click on it. Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 1 3 KVS DELHI REGION 2021 >>> is known as Python prompt. Once you get a prompt, you can start programming. Exercise: Something to Known A. Answer the following questions: 1. What is Python? 2. Write the steps to install python in your computer. 3. Write any three features of Python. 4. How will you check whether your Operating system is 32 bit or 64 bit? 5. Python can be downloaded from which website? B. Fill in the blanks: 1. Python is …………………..language. 2. Python was developed by …………………….in 1989. 3. Python is named after …………………………………………… 4. ……………………. is that converter program which converts high level language to machine language one statement at a time. 5. …………………. and ………………….. are companies that use python in the organization. Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 1 4 KVS DELHI REGION 2021 C. Match the following: A B a. Represents version number 1. >>> b. Refers to develop program on one platform and run anywhere. 2. 3.x c. Represents to python prompt 3. python.org d. is website to download Python 4. App Data of current user e. Default Folder of python installation is 5. Portability D. Select the correct answer for each question: 1. Who developed the Python language? a. Zim Den b. Guido Van Rossum 3. Mark Zukerberg 4. Wick Van Rossum 2. In which year was Python language developed? a. 1995 b. 1973 c. 1989 d. 1981 3. Which of the following denotes to Python prompt? a. &&& b. @@@ c. >>> d. $$$ 4. Which of the following is not a python feature? a. Case sensitive b. Portable c. Not Open Source d. Interpreted 5. Python can be installed on which of the following Operating System. a. Windows b. Linux c. Macintosh d. All of these E. State True or False 1. Python is a case sensitive programming language. 2. Python code is not portable in nature. 3. To download python, one needs to pay license fee. 4. GUI application can be developed using python. 5. Python is an Interpreted language. Something to Do: 1. Open Browser and type www.python.org and find the latest version of Python for Windows. 2. Take an A4 sheet and paste pictures of steps of the installation process. 3. Take a sheet and diagrammatically represents all features of Python. Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 1 5 KVS DELHI REGION 2021 2.4 Python Basics We have already discussed about Python, its features and installation process in the previous chapter. Now to understand a programming language, you must learn fundamental concepts for python beginners. These fundamental building blocks are keyword, variable and datatypes. Let’s take a deep look into these terminologies. 2.4.1 Keyword: Keywords are the reserve words that have special meanings and purposes. Python interpreter interprets these words and performs actions accordingly. Characteristics of Keyword: 1. We can’t use a Keyword as variable name. 2. Keywords are used to define syntax and structure of Python language. 3. Python keywords are case sensitive. 4. Python 3.8 supports 35 such keywords. Python Keywords: few keywords are listed here: False break for import True None is and def from if or Keyword Usage: Suppose we want to assign False in a variable X. X=False (False is keyword to assign Boolean false value) 2.4.2 Variable: Variable is just like a small container that can hold a value in it. A variable is simply a memory location that is reserved to store some value. In python, a variable is created the moment you first assign a value to it. For example: X=8 X is a variable of integer type. In python, the value assigned to a variable determines its type. X=” Computer” X is a string variable. Therefore, a variable can change its type after it has been set. X was integer in the first case while it changes to string type in later. Why do we require variable? You must have used variables in mathematical expression. What does it do? If I have written x=5*y where y=3 then what will be the value of x. You can see the value of x is dependent on the value of y. In this case x and y are variables. Now, if the value of y is changed by the user, the value of x automatically changes as per the new value of y. Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 1 6 KVS DELHI REGION 2021 In computer programming, you need variables to hold user inputs, intermediary results and output. Variable Naming Convention: Each language has its own set of rules to declare and initialize a variable. Python also has some set of conventions to follow when naming a variable: 1. A variable name can include alphabets, digits and underscore. 2. Variable name should be user friendly. 3. Variable names are case sensitive. 4. A variable name can’t start with a digit. 5. A variable name can’t contain space character. Let’s take some examples and understand valid and invalid variable name. Name, first.name, 2ndName, amount in $ In above examples, only Name is a valid identifier or variable name. Read the convention and try to identify the reason for wrong variable names. Variable names are case sensitive means names written in lowercase and uppercase are treated as two different variables. Like Age and age are two different variables. Assigning values to variable: To assign a value to the variable, an equal (=) symbol is used. Age=23 Age is a variable with value 23. 2.4.3 Data type: Now, how much memory that variable occupies depends on the type of data it is assigned to. Therefore, data types allocate the memory required to store the variable. Python supports 5 standard data types. 1. Number- The data types which store numeric values are called Python numbers. Python has three kind of numeric values:- integer, float and complex X=89 (X is a Integer variable) Y=89.6 (Y is a float variable) Z=23i+j (Z is a complex variable) 2. String: means sequence of characters. These sets of characters are represented in either single quote (‘’) or double quotes (””). Name=”Akbar” Or Name= ‘Akbar’ 3. List 4. Tuple 5. Dictionary Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 1 7 KVS DELHI REGION 2021 Exercise: Something to Know A. Answer the following questions: 1. What do you mean by term keyword? Write any two characteristics of the keyword. 2. Write any three variable naming conventions. 3. Why do you require variables? 4. What is data type? How many data types are supported by python? 5. Differentiate between Keyword and Variable. B. Fill in the blanks: 1. …………………… are the reserve words that have special meanings and purposes. 2. A ……………………..is simply a memory location that is reserved to store some value. 3. 1digit is a …………………..identifier. 4. ……………………. refers to type of data and associated operations. 5. …………………. , ……………. and ………………….. are supported in python variable naming. C. Match the following: A B a. Complex is a 1. Assignment of value b. Variable names are 2. Case sensitive c. Python 3.8 contains 3. Number data type d. X=90 termed as 4. Data type e. Dictionary is a 5. 35 keywords D. Select the correct answer for each question: 1. Keywords are: a. Reserve Words b. Simple Text c. Variables d. None 2. Which of the following is not a valid identifier? a. Age b. aGe c. Age_ d. 1st_age 3. Which data type represents a whole number? a. String b. Integer c. Float d. Boolean 4. Which data type would the following be stored as: “Pizza” a. Integer b. String c. Boolean d. Float Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 1 8 KVS DELHI REGION 2021 5. Which of the following is an integer? a. 4 b. 0.4 c. 4.0 d. c E. State True or False. 1. Variable names can start with a digit. 2. Only double quotes are used to declare a string. 3. As per python, amount and Amount are two distinct variables. 4. Keywords are used to hold values. 5. Annual.salary is a valid identifier. Something to Do: 1. List all keywords used in Python. Use the following command to get a list of keywords in python. >>>help (“keywords”) 2. Establish a relationship between Keywords, variable and data type with an example. 2.5. Python Operators In this chapter, you will learn about how to perform different types of operations in python using operators. Operators are special symbols that are used to perform operations on operands. An operator requires some operands to work upon. Operands may be variable or constant. Operator: Operators are special symbols that are used to perform operations on operands. The values that the operator operates on are called operands. Expression: Expression is combination of operator and operands. In an expression x=y+9, x,y,9 are operands while =,+ are operator. Types of Operator: Python allows 08 types of operators. In this chapter, we will discuss about two types of operators. 2.5.1 Arithmetic Operator: Arithmetic operator is used to apply basic mathematical operations like addition, deletion, multiplication, division, etc. These operators require two operands to operate. Following are some of the binary operators. Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 1 9 KVS DELHI REGION 2021 Name of Operator Symbol used Purpose Example Addition + Summation of Numbers X=5+6 will yield 11 Subtraction - Subtraction of Numbers X=9-5 will yield 4 Multiplication * Product of Numbers X=3*4 will yield 12 Division / Division of Numbers X=9/3 will yield 3.0 Modulus % Return remainder X=5%2 will yield 1 Floor Division // Divides and truncates the fractional part from result X=7//2 will yield 3.0 Exponentiation ** Return base raised to power exponent X=3**3 will yield 27 2.5.2 Relational Operator: Relational operators are used to describe relationships between values or operands. In python, you will use six relational operators for comparing values. These operators are also known as comparison operators. The six relational operators are: Operator Example if a=9, b=5 Result > Greater than a>b True < Less than a<b False >= Greater than or equal to a>=b True <= Less than or equal to a<=b False == Equal to a==b False != Not equal to a!=b True You can conclude that the resultant of the comparison operator will be either True or False. Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 2 0 KVS DELHI REGION 2021 Exercise: Something to Know A. Answer the following questions: 1. What do you mean by operator in python? 2. Explain the term: a. Operand b. Expression 3. What is a relational operator? 4. Explain the purpose of the Modulus operator? 5. Differentiate between division and floor division operator. B. Fill in the blanks: 1. The values that the operator operates on are called…………………………. 2. 9%3 will evaluate to …………… . 3. ……………………... is the combination of operator and operands/values. 4. ………………….operators are also known as comparison operators. 5. ……………………….. will be the resultant of expression 17//4. C. Match the following: A B a. 24//5 1. 81 b. 3**4 2. Relational Operator c. >= 3. 4 d. % 4. Expression e. X=a+b+c 5. Arithmetic Operator D. Select the correct answer for each question: 1. if a =16//4 and b=9, what will be the resultant of a>Gowri: a. True b. False c. None 2. Which of the following is not an arithmetic operator? a. % b. ** c. > d. // 3. Which of the following is not an expression? a. d=x+y**2 b. ZZ=yy+xx c. “Radhe” d. b=x**2+y 4. Which of the following is used to describe relationships among values? a. Operand b. Arithmetic operator c. Relational Operator d. Expression 5. Which of the following will be the result of 9/3? Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 2 1 KVS DELHI REGION 2021 a. 3 b. 3.0 c. 9.0 d. 0 E. State True or False. 1. + is a type of operand. 2. == operator is used to compare two values/variables. 3. = operator is also known as assignment operator. 4. Expression 225%5 will return zero 5. Python contains 05 relational operators. Something to Do: 1. Do the practice of operators with following variables and write the correct result for E. if a=8, b=9 ,c=6 a. E=a**2+b b. E=a//2+b/3+c**2 c. E=(a%5+b)%3 2. Give the resultant value for the following expression: a. “Ravi”>”ravi” b. a< (b%3) Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 2 2 KVS DELHI REGION 2021 3. Python Programming 3.1 Basic Programming 3.1.1 Writing and compiling a Program 3.1.2 Creating First Program 3.1.3 Understanding print() 3.1.3 To do Simple Programs 3.1.1 Writing and Compiling a Program: You have learned the basics about python programming language. In this section, you will learn how to open python IDLE (Integrated Development Learning Environment), write a program and execute it. To create and run a python program, you need to do the following steps: 1. Open an IDLE text editor to write a program 2. Save your program with .py extension 3. Compile and execute a program by pressing F5 Step 1: Click on Start Button Step 2: Choose Python IDLE and you will get following screen. Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 2 3 KVS DELHI REGION 2021 Step 3: Click on File Menu ->New option and write program and save file with .py extension. Step 4: Now you can compile and execute this program by pressing F5 key. You will get the result on the python shell. 3.1.2 Creating First Program: You have to create your first program which will print “Hello World” on the screen. To do this activity type the following code: # My first Program print(“Hello World”) Save the program and execute it. Python will give following one line output: Hello World You have noticed that you wrote two statements but you get one line of output. Why so? This is because # symbol represents that first statement is a remark/comment which is being ignored by the compiler to compile. 3.1.3 Understanding print() method: print() function is used to print or display or display output. Syntax: print(variable/message) For Example 1: A=5 B=6 S=A+B print(S) # here variable S is given and the value of variable will print. You will get output as 11 because the value of S is 11. Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 2 4 KVS DELHI REGION 2021 Example 2: print(“This is Python Program”) # here message given in double quotes You will get output as : This is Python Program Example 3: Printing value and message together: A=5 B=6 S=A+B print(“Sum of A and B is”, S) # here variable S is given & message is given in double quotes. You will get output as: Sum of A and B is 11. 3.1.4 Creating Simple Programs Program1: Write a program to display a message “Hello Friends, How are you?” Program2: To find area of a square, if side of square is 5. Process: side*side Output: Area Program 3: To find area of a rectangle, if length =10 cm and breadth is 6 cm. Process: Length* Breadth Output: Area Exercise: Something to Know A. Answer the following questions: 1. Write the steps required to create and run a program? 2. What is the full form of IDLE? 3. Which key is used to execute a program? 4. What is the purpose of print() function? 5. What is a comment? Which symbol is used to define a comment? Code: print(“Hello Friends, How are ?” Code: Side=5 Area=side*side print(“Area of Square=”,Area) Code: Length, Breadth=10, 6 Area=Length*Breadth print(“Area of Square=”,Area) Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 2 5 KVS DELHI REGION 2021 B. Fill in the blanks: 1. …………………key is used to execute a program. 2. …….. is used to declare a comment in a python program. 3. ……………… function is used to display output. 4. ………………... is an important part of a program to get output. 5. Python program file saved with ………extension. C. Match the following: A B a. Compilation process 1. .py b. # 2. is a function c. File Extension Name 3. F5 d. Output 4. Comment e. Print() 5. Resultant value D. Select the correct answer for each question: 1. Which function key is used to execute a python program? a. F9 b. F11 c. F5 d. F1 2. Which symbol is used to define a comment in python? a. “ b. ** c. # d. // 3. A Python program file contains …..extension name? a. .px b. .pz c. .py d. .pp 4. Which of the following you may not get after executing a program? a. Error b. Result c. Expression d. Output 5. print() function is used to ? a. Output b. Input c. Process d. Interpret E. State True or False. 1. $ is used to display a comment in a python program. 2. PRINT(“Hello”) and print(“Hello”) will display the same output. 3. F5 key is used to execute a python program. 4. Each python program is stored in a separate file containing .py extension. 5. Python contains a text editor and interpreter in IDLE. Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 2 6 KVS DELHI REGION 2021 Something to Do: 1. Write a python program to find the perimeter of a square, if side is given as 7 cm. 2. Write a python program to find the perimeter of a rectangle, if length is 9 cm. and breadth is 3 cm. 3. Write a python program to display the area of a circle, if the radius is 4 cm. 4. [Hint: Area=3.14*radius*radius] 5. Write a python program to calculate simple interest for principal amount 5000 for a period of 3 year with 5% interest rate. 3.2 Python Programming – Decision Structure 3.2.1 Inputting Values 3.2.2 Decision Structure 3.2.3 Practice 3.2.1 Inputting Values Dear students, you learnt about programming basics and development of program in the previous chapter. You know each program may consist of input, process and output. In the previous chapter, programs generated output on the basis of fixed value. Example 1: Program to find sum of A and B. A=5 B=6 S=A+B print(“Sum of A and B is”, S) You will get output as: Sum of A and B is 11. In this example, you will always get the same output on execution of program, because the values of A and B are fixed. Can you give value of A and B at the time of execution of program? Yes, you can give values of A and B at run time. To input values at run time, you require an input () function. Syntax: variable = input(message) Program2: Write a program to display a message received from user. In this program, whatever message will be given by the user will be displayed by a print statement. Code: msg=input(“Give your message”) print(msg) Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 2 7 KVS DELHI REGION 2021 Program3: Write a program to input the age of a person and display her age increased by 2 year. This program will produce Type error on execution. Because input() function receives value in form of string while you are trying to do mathematical operation with age in line 2. This is not possible without conversion of string into integer/float. How to do conversion of inputted values? Change the 1st line of code in program 3 with the following line and execute your program. age=int(input(“Enter your age”)) It will execute successfully and give you an increased value of age by 2. To do conversion into integer and float values, int() and float() functions will be used respectively. Program 4: Write a program to calculate the average of 3 inputted numbers. Code: A=int(input(“Enter value of A”)) B= int(input(“Enter value of B”)) C= int(input(“Enter value of C”)) S=A+B+C Avg=S/3 Print(“Average of Numbers is “,Avg) Program 5: Write a program to calculate xn . Where x is base and n is exponent. x= int(input(“Enter base value”)) n=int(input(“Enter exponent”)) pow=x**n print(pow) Program 6: Write a program to calculate Body Mass Index of a person. [BMI=m/h2 where m is mass in kg and h is height in meters] Code: m=int(input(“Enter body weight in kilogram”)) h= int(input(“Enter height in meter”) BMI=m/h*h Print(“Your BMI is “, BMI) Code: age=input(“Enter your age”) age=age+2 print(age) Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 2 8 KVS DELHI REGION 2021 3.2.2 Decision Structure: Decision structure in programming allows you to execute statements on the basis of given condition. If condition evaluates to True one set of statements executed otherwise another set of statements executed. In python, decision structure is implemented through if…else statement. The if…else statement evaluates test expression and will execute the body of if only when the test condition is True. If the condition is False, the body of else is executed. Statements that are written at the same indent form a block. Syntax: if<condition>: Statement1 Statement2 …. else: Statement1 Statement2 …. 3.2.3 Practice : Let’s understand it with an example. Program 7: Program to check whether inputted number is positive or negative. You will write the following code. Code: Num=int(input(“Enter a number”)) if Num>0: print(“Number is positive”) else: print(“Number is negative”) You can observe, we have applied a condition Num>0. If number is greater than 0 then its positive otherwise number is negative. We can write single statements or multiple statements in any part of a decision statement. Program 8: Program to check whether a person is eligible to vote or not. Code: Age=int(input(“Enter your age”)) if Age>=18: print(“You are eligible to vote”) else: print(“You are not eligible to vote”) if section Body (Block 1) else section Body Bl 2 Executes when condition is True. Executes when condition is False. Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 2 9 KVS DELHI REGION 2021 Program 9: Program to check whether given angle is straight angle or right angle. Code: angle= int(input(“Enter Angle”)) if angle==90: print(“It’s a right angle”) else: if angle==180: print(“It’s a straight angle”) In this example, we have used two if statements. We will discuss it in detail in class 8. Exercise Something to Know: A. Answer the following questions: 1. Which function is used to take user input at run time? 2. Ravita wrote a program to find the sum of marks of 03 subjects. She is getting error in her program. Help her to resolve errors? Sub1=input(“Enter marks of Subject1”) Sub2= input(“Enter marks of Subject2”) Sub3= input(“Enter marks of Subject3”) Total=Sub1+Sub2+Sub3 print(Total) 3. When do you use a decision statement? 4. What is if..else statement? Write its syntax? 5. Why do you use int() and float() function? B. Fill in the blanks: 1. …………………is a set of statements written at the same indent. 2. …….. function is used to take user input at run time. 3. ………………… is an optional component in if… else statement. 4. A …………………… is a condition that evaluates to True or False in if…else statement. 5. The if…else statement is also known as …………………………….. C. Select the correct answer for each question: 1. What is output of this code? spam=9 if spam>6: print(“Nine”) if spam>17: print(“Seventeen”) a. Nine b. Seventeen c. Six d. Nothing Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 3 0 KVS DELHI REGION 2021 2. What signifies the end of a statement block? a. A comment b. } c. end d. A line that is indented less than the previous line 3. Following Code will return: if False: print(“Audi”) else: print(‘Mercedez”) a. Audi b. Mercedez c. True d. False 4. Following Code will return: if 1: print(“ Honest”) else: print(“Biased”) a. Honest b. Biased c. Nothing 5. Following Code will return: if 5==15%3: print(“5”) else: print(15%3”) a. 5 b. 0 c. 15%3 d. None Something to Do: 1. Write a python program to accept two integers and check whether these are equal or not. 2. Write a python program to check whether the inputted number is even or odd. 3. Write a python program to accept two integers and display maximum between them. 4. Write a python program to accept two integers and display minimum between them. 5. Write a python program to accept the percentage of marks and display “Pass” if marks is greater than 40 percent otherwise display “Fail”. Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 3 1 KVS DELHI REGION 2021 4. INTRODUCTION OF GIMP 4.1 Introduction to GIMP. 4.2 GIMP features 4.3 How to download GIMP 4.4 GIMP file formats 4.5 Let us start gimp GIMP There are so many photo editing software like Photoshop, Microsoft Paint and Drawing of Open Office.org etc. In this chapter, we are going to study GIMP (GNU Image Manipulation Program) software. GIMP is Free & Open Source Image Editor software. It is used for image editing and manipulation. GIMP is a multi-platform photo manipulation tool. Most GNU/Linux distributions include GIMP as a standard application. The GIMP is also available for other operating systems such as Microsoft Windows™ or Apple’s Mac OS X™ (Darwin). The GIMP is a Free Software application covered by the General Public License [GPL]. The GPL provides users with the freedom to access and alter the source code. Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 3 2 KVS DELHI REGION 2021 4.2 GIMP FEATURES ARE: ● It is Open and Free software. ● It supports different file formats such as gif, jpeg, tiff etc. ● It works with different operating systems such as Linux, Mac OS and Microsoft Windows. ● It is used for image manipulation (retouching) and image editing. ● GIMP provides different tools for image editing. ● GIMP paintbrush tool is used to draw images easily. ● It is a memory efficient graphic tool. ● Combining different images in GIMP to create animation. ● There are several ways of creating colors in GIMP. 4.3 HOW TO DOWNLOAD GIMP Following are the steps to download GIMP:- ● Search website www.gimp.org ● Click on Download. ● Click “Download Gimp” Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 3 3 KVS DELHI REGION 2021 After completion of downloading, install GIMP on computer. 4.4 GIMP FILE FORMATS Formats Expansions PSD Photoshop PCS Personal Computer Exchange XPM X Pixmap JPEG Joint Photographic Experts Group PPM Portable Pixmap TIFF Tagged Image File Format GIF Graphics Interchange Format BMP Bitmap XWD X Window System PNG Portable Network Graphics GIMP Compatible Platforms: ❖ GNU/Linux (i386, PPC) ❖ Microsoft Windows (XP, Vista, Windows 7) ❖ Mac OS X ❖ Sun OpenSolaris ❖ FreeBSD Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 3 4 KVS DELHI REGION 2021 4.5 LET US START GIMP How to Open Gimp Software Step 1: Select Start → All Programs → GIMP 2.10.22 Step 2: GIMP 2.10.22 window appears. Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 3 5 KVS DELHI REGION 2021 GIMP WINDOW Step 3: Create a New File 1. Click on File Menu 2. Click on New option Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 3 6 KVS DELHI REGION 2021 3. Enter height or width. 4. Or choose a template and a dialog box will appear. You can select the template and specify the size by setting values for both height and width. 5. Press OK. Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 3 7 KVS DELHI REGION 2021 A new blank image file is open. Now, you can use the tools and create your own drawings. Step4: How to Save a File 1. Click on FILE → SAVE/SAVE AS… Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 3 8 KVS DELHI REGION 2021 2. The Save Image dialog box appears Give a name to the file, select the format of the image and click on the save button. Steps to open an existing file 1. Click on file Menu Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 3 9 KVS DELHI REGION 2021 2. Select Open option 3. Select the file name and click on Open button EXERCISE SOMETHING TO KNOW A. Multiple Choice Questions: 1. What does GIMP stand for? a. GNU Image Making Program b. GNU Image Masking Program c. GNU Image Manipulation Program d. GNU Image Multiplication Program 2. GIMP is …………………….editing tool used for images a. Proprietary b. Open Source c. Shareware d. None of these 3. GIMP ……………………tool is used to draw images easily. a. Selection b. Draw c. Paintbrush d. Fill Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 4 0 KVS DELHI REGION 2021 4. GIMP's latest version is .......…... a. 2.10.12 b. 2.10.22 c. 2.12.10 d. 2.10.10 5. GIMP software can be downloaded from ……………. website a. www.gimp.com b. www.gimp.org c. www.gimp.in d. All of the above B. STATE TRUE(T) / FALSE(F) 1. GIMP is a proprietary software. 2. Microsoft Windows (XP, Vista, Windows 7) are GIMP compatible Platform. 3. BMP is one of the file formats of GIMP. 4. GIMP cannot be used as a paintbrush. 5. GIMP provides different tools for image editing. C. ANSWER THE FOLLOWING QUESTIONS: 1. Write down any four features of GIMP? 2. List GIMP Compatible Platforms. 3. Explain GNU Image Manipulation Program? 4. Write down the expansions of the following : (a) gif (b) .png (c) .tff (d) .jpeg 5. Write down the steps to open an image in GIMP? SOMETHING TO DO Download GIMP on your PC/Laptop and create a blank image and save with name image1. Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 4 3 KVS DELHI REGION 2021 Select by color Tool [Shift + 0 ] This tool is used to select areas or regions of an image based on color similarity. Crop Tool [Shift + C] Remove edge area from image or layer. Unified Transform Tool [Shift + T] This tool is used to transform the layer, selection or path. Rotate Tool [Shit +R] This tool is used to rotate selection, path or layers from horizontal to vertical and vice versa. Scale Tool [Shift +S] This tool is used to scale layers, selections or paths (the Object). Shear Tool [Shift + H] This tool is used to shift one selected part of an image, a layer, a selection or a path to a direction and the other part to the opposite direction. Flip Tool [Shift +F] This tool is used to reverse the layer, path or selection horizontally or vertically. Perspective Tool [Shift +P] This tool is used to change the perspective of the layer, selection or path. 3D Transform Tool [Shift +W] This tool is used to apply 3D transformation to the layer, selection or path. Handle Transform Tool [Shift +L] Deform the layer, selection or path with handles. Wrap Transform [W] Deform with different tools. Cage Transform [Shift +G] Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region
P a g e | 4 4 KVS DELHI REGION 2021 Deform a selection with a cage. Bucket Fill Tool [Shift +B] This tool fills a selected area with color or pattern. Gradient Tool [G] This tool is used to fill selected area with color gradient. Paintbrush Tool [P] This tool is used to draw brush-like strokes, as if you were painting. It paints smooth strokes using a brush. Pencil Tool [N] This tool is used to draw using pencil. Air Brush Tool [A] This tool is used to paint using a brush. Ink Tool [K] This tool is used to paint calligraphy style. My Paintbrush Tool [Y] Use of paintbrushes in GIMP. Eraser Tool [shift + E] This tool is used to remove areas of color from the current layer or from a selection of this layer. While erasing if it does not support transparency, then it will display the background color. Clone Tool [C] This tool is used to copy from an image or pattern using brush. Perspective Clone Tool This tool used to clone from an image source after applying perspective transformation. Healing Tool [H] This tool is used to heal image irregularities. Smudge Tool [S] This tool is used to smudge colors on the active layer or the selection. Copyright Number:- L-101962/2021 Registered With:- KVS Delhi Region