CBSE CS and IP

CBSE Class 11 & 12 Computer Science and Informatics Practices Python Materials, Video Lecture

Showing posts with label Class 11 CS. Show all posts
Showing posts with label Class 11 CS. Show all posts

Cyber Law IT ACT 2000

CYBER LAW


What is cyber Law?


  • Cyber law, also known as cybercrime law, is legislation focused on the acceptable behavioral use of technology including computer hardware and software, the internet, and networks.
  • Cyber law helps protect users from harm by enabling the investigation and prosecution of online criminal activity.
  • It applies to the actions of individuals, groups, the public, government, and private organizations.

Overview of Indian IT ACT

  • The Information Technology Act, 2000 (also known as ITA-2000, or the IT Act) is an Act of the Indian Parliament notified on 17 October 2000. It is the primary law in India dealing with cybercrime and electronic commerce.
  • A major amendment was made in 2008 and now it is called the IT (Amendment) Act 2008.

Some Suggested questions that may be asked in board examination Class 12 CS/IP

  1. What is Cyber Crime? Write the act that deals with it.
  2. What is IT Act, 2000? Write down 2 salient features of IT Act, 2000.
  3. Difference between Cyber Crime and Cyber Law.

Class 11 Computer Science Video Lectures

String Data Type in Python

Strings in Python
String Definition / What Is Strings in Python?

Python string is characters/numbers/special characters enclosed in quotes of any type - single quotation marks (' '), Double quotation marks ( " ") and triple quotation marks (" " "). An empty string is a string that has 0 characters (i.e. it is just a pair of quotation marks) Python string is immutable. you have used string in earlier chapters to store text type of data.

Every character of the string is given a special number that is called its index position. Consider the following string:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
my_string = "Hello World"
print(my_string)
print(type(my_string))

'''
Output:
Hello World
<class 'str'>
'''

#Index Positions
# H   e  l  l  o  W  o  r  l  d
# 0   1  2  3  4  5  6  7  8  9 (Forward)
#-10 -9 -8 -7 -6 -5 -4 -3 -2 -1 (Backward)                         

By the above example, you can see that my_string is a variable of string type and all the characters of the string will have one unique index.

By now you must know that strings are a sequence of characters. where each character has a unique position - id/index. The index of a string begins from 0 and end on (length - 1) in the forward direction and -1,-2,-3....,-length in the backward direction. As in the example in the forward direction index are 0,1,2....,9 and in backward direction -1,-2,-3.....-10.

Accessing Individual elements of Python String

Since every elements has its Unique Index in Python we can access any element from string by just providing the Index in square brackets with string Name. See the following Example:
1
2
3
4
5
6
7
8
9
>>> my_string = "Hello World"                                      
>>> my_string[0]
'H'
>>> my_string[1]
'e'
>>> my_string[-1]
'd'
>>> my_string[-2]
'l'

Traversing A String -:

Traversing refers to iterating through the elements of a string, one character at a time. You know that individual characters of a string are accessible through the unique index of each character. Using the indexes you can traverse string character by character. We can traverse a string by using the for loop. You can write a loop like :
Example -:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
for i in "Hello World":                                            
     print(i)

'''
Output:
H
e
l
l
o

W
o
r
l
d
'''

String  Operators -:

You will be learning to work with various operators that can be used to manipulate strings in multiple ways. We will be talking about basic operators + and * membership operators in and not in and comparison operators (all relational operators) for strings.
  1.  Basic Operators
  2.  Membership Operators
  3.  Comparison Operators

(1) Basic Operators -: 

The two basic operators of the string are + and *. You have used these operators as arithmetic operators before for addition and multiplication respectively. But "+ operator" is used with string operands it performs "concatenation" rather than addition and "* operator" performs "replication" rather than multiplication.

Also before we proceed,  recall that strings and immutable i.e. and un-modifiable. Thus every time you perform something on a string that changes it Python will internally create a new string rather than modifying the old string in place.

a) Working Of Python * operators -:

The * operator, when used with numbers, (i.e.  When both your operands are numbers),  it performs multiplication and returns the product of the two number operands.

To use a * operator with string, you need to type of operands-:
(1) string
(2) number
It can be in the following forms:
number * string or string * number

Where string operands tell the String to be replicated and number operand tells the number of times, it is to be repeated. Python creates a new string that is a number of repeated addition of the string operator.
Example -:
1
2
3
4
5
6
>>> my_string = "Hello World"
>>> my_string * 3
'Hello WorldHello WorldHello World'
>>>
>>> 3 * my_string
'Hello WorldHello WorldHello World'                                

b) Working Of Python + Operators -:

This + operator has to either have both operands of the number types (for multiplication) or both should be of string type. It can not work with one operand string types and another as number type.
Example-:
1
2
3
4
5
6
>>> "Hello" + "World"
'HelloWorld'
>>> "Hello" + 2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can only concatenate str (not "int") to str             
In the above example, you can see we can not add One String and One number.

(2) Membership Operators -:

There are two membership operators for string (in fact for all sequence types). These are in and not in. Let us learn about these operators in the context of strings.

in         -: Returns TRUE if a character or a substring exists in the given string; FALSE otherwise
not in  -: Returns TRUE if a character or a substring does not exist in the given string; FALSE otherwise

both membership operators (when used with string), require that both operands used with them are of string type i.e.
Example-:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
>>> 'H' in 'Hello World'
True
>>> 'Y' in 'Hello World'
False


>>> 'H' not in 'Hello World'
False
>>> 'Y' not in 'Hello World'                                       
True

(3) Comparison Operators -:

Python standard comparison operators i.e. All relational operators (<,<=,>,>=, ==, !=)  apply to strings also. The comparisons using these operators are based on the Standard character by character comparison rules for Unicode (i.e. Dictionary order).

Equality and Non-Equality in strings are easier to determine because it goes for exact character matching for individual letters including the case (uppercase or lowercase) of the letter. 

But for another comparison like less than (<)  or greater than(>)  you should know the following piece of useful information. 
  • Python checks the Ordinal values while comparing String using (<, >, <=, >=).
  • You can find the ordinal value of any char by using ord(<char>) function. Find the characters and their ordinal values(ASCII values):
    Characters Ordinal Values
    ‘0’ to ‘9’ 48 to 57
    'A’ to ‘Z’ 65 to 90
    ‘a’ to ‘z’ 97 to 122
  • Ordinal values are compared character by character.
Example-:
1
2
3
4
5
6
7
'a'  <  'A'             False
'A'  >  'a'		True
'ABC' > 'AB'	        True
'abc' <=  'ABCD'	False                                      
'abc' < 'Acd'	        False
'abc' > 'Acd'	        True
'abcd'> 'A'	        True	

Cyber Safety And Security (CBSE Class 11)

cyber safety and security class 11 cbse
What is cyber safety/Internet Safety?

Today's age cannot be thought without the Internet, even in dreams. Nowadays every person is being a victim of online fraud. Mostly children are caught in this trap so the first thing we need to know is how to protect a child from online fraud? The government has started its cyber safety and security lesson for the 11th class. So that children can avoid online fraud. For this, the parents have to be aware of and follow the tips of cyber safety. Although the internet has made many things easier at the same time it has posed many security risks too, if not used properly.
Cybersafety refers to the safe and responsible use of the internet to ensure the safety and security of personal information and not posing threat to anyone else information.

Top 5 Cyber Crime Safety And Security Tips -:

Here we will discuss some cyber security and safety tips that will let us know how to prevent cyber crime? and learn more solutions to cyber crime. we mention some tips:-
  1. identity protection while using the internet
  2. many ways website track you 
  3. Confidentiality of information and strong password
  4. Avoid using public computers
  5. Carefully handles Emails

1) Identity Protection While Using The Internet -:

Identity theft is a type of fraud that involves using someone else's identity to steal money or gain other benefits.when we give out private data like filling up some forms, online payment, then they can be used for harmful reasons like hacking, stalking, and identity fraud.
A most common solution to this private browsing like incognito browsing opens up a browser that will not track your activities. If you are entering data like bank detail into the browser.

2) Many Ways Websites Track You -:

Whenever you visit a website, your web browser may reveal your location via your device's IP address. It can also provide your search and browsing history etc. Which may be used by third parties, like advertised or criminal. This way website tracks you. This generally includes -:

-IP Address -: IP address is a unique address of your device when you connect to the internet.it's likely that your computer shares your IP address with the other networked devices in your office. Your geographical location can be determined by your IP address, any website that you are accessing can determine your rough location.

-Cookies And Tracking Script -: Cookies are small pieces of information that a website can store in your browser. When you sign-in to your online banking website, a cookie remembers your login information. When you change a setting on a website, a cookie store that setting so it can persist across page loads and sessions. For example, you change the zoom percentage of your webpage then this setting will reflect on all opened pages because this was stored in cookies.

3) Confidentiality Of Information And Strong Password-: 

The Internet is a public platform. The sites you visit, the things you search on it, the posts that you put on social networking sites all visible to the public. But there must be some information like your credit history or bank details, your mail, etc. which you do not want to make public i.e. you want to keep this information confidential.
If you visited any website and fill forms like sign up, log in, personal, bank details, etc then you create a powerful password include capital letter alphabet, numeric symbols, etc. Due to a strong password,  your chances of getting hacked are less and your personal information is safe.

4) Avoid Using Public Computers -:

If you need to work on public computers then make sure following things -:
1) Don't save your login password.
2) Avoid entering sensitive information onto public computers.
3) Properly log out before you leave the computers.
4) Erase history and cookies.

5) Carefully Handles Email -:

While opening an email, make sure that you know the sender. even if you open the email message by accident, make sure not to open an attachment in an email from an unrecognized source. Also, your mail might contain a link to a legitimate-looking website, never click on any link inside an email. The link might look legit but it may take you to a fraudulent site. Even if you need to visit the linked website, type the URL of the website on your own in the address bar of a web browser but never open any link by clicking inside an email or by copying its link.

Comments (Single/Multiline) in Python

Comments (Single/Multiline) in Python


DataCamp

What is Comment in Python?

Any remark such as who made the code and the purpose in the form of a note can be added in the program using comments. Comments are not executed by the interpreter, they are added with the purpose of making the source code easier to understand by humans. The documentation of the code is done with the help of comments in the program itself. 

Comments are the additional readable information to clarify the source code, which is read by the programmers but ignored by the Python interpreter.

Why it is important to use Comments?

Whenever developers make a program, gradually so many codes are written in the same file for the different types of functionality. If commenting is not proper,  after some time, we do not understand our own code. We will face difficulty in understanding the codes written in our own program. So to easily understand the same problem, we use comments.
When you are working on a project with your team, it is necessary to use comments so that other programmers can understand what you have done in the source code by looking at the comment.
Using comments in our code makes our code easier to understand.

How do you write comments in code?

  • Comments are used to explain the code, which code is written for which work.
  • Comments are not part of the program, yet it is most useful for understanding the code.
  • Single line comments in Python begin with a symbol # (hash character) and generally end with the end of the physical line. (A physical line is the one complete line that you see on a computer whereas a logical line is the one that python sees as one full statement).
  • Multiline comments can be used in a program by simple put our text inside triple double-quotes (" " ") or triple single-quotes  (' ' '). Comments enclosed with triple quotes are called Docstring (Document String)

How many types of Comments?

Python has two types of comments, which are given below -:
  1. Single-Line Comments
  2. Multi-Line Comments

Single-Line Comments

In Python, Single line comments start with (#) symbol. 
If we put a # symbol at the starting of any line, then that line will be treated as a comment line. This line will not execute at the execution time, interpreter simply ignores it.
Example -: A single line comments in the program
# Single Line Comment
# Single Line Comment 

Multi-Line Comments

Multi-line comment in python code in two ways  -:
  1. Add a # symbol at the beginning of every physical line part of the multi-line comments.
  2. Type comment as a triple quoted multi-line string. This type of comment is also known as the docstring. You can either use a triple single-quote (' ' ') or triple double-quotes (" " ") to write a docstring. 
Example -: A Multi-line comments in the program
'''
This is a multiline Comment
This is a multiline Comment
This is a multiline Comment
'''
"""
This is a multiline Comment
This is a multiline Comment
This is a multiline Comment
"""


Benefits of using Comments in Python?

  1. The code can easily be understood when using comments.
  2. Makes code readable and understandable.
  3. Using Comments, we remember why we used this code.
  4. If the program is opened in the future, then there is no problem in understanding the code.
  5. Using comments gives the programmer an idea as to why they are using this code.