Friday, 23 February 2024

Decision control statements

 Decision control statements: To know in detail click here

1. If Statement:

Syntax:
if expression: #execute your code

Example:1

x = 30
if(x > 20):
    print(" x is largest")



2. If else Statement:

Syntax:
if expression: #execute your code else: #execute your code

Example:2

m = 30
n = 20
if(m > n):
    print(" m is largest")
else:
    print(" n is largest")

3. Nested if:

if statement inside if statement is called as nested if statement.

Syntax:
if expression: #execute your code
    if expression:
        #execute your code
    else:      #execute your code


Example:3
a = int(input("Enter your number"))

if a > 10:
  print("Above ten,")
  if a > 20:
    print("and also above 20!")
  else:
    print("but not above 20.")

4. elif Statement:

elif - is a keyword used in Python replacement of else if to place another condition in the program. This is called a chained conditional.

Syntax:
if expression: #execute your code elif expression: #execute your code else: #execute your code



Example:4


x = int(input("Enter your number:"))
y = int(input("Enter your number:"))

if x > y:
  print("x is greater")
elif x == y:
  print("both x and y are equal")
else:
  print("y is greater")


BASIC LOOP in Python:

Python has two primitive loop commands:

  • while loops
  • for loops
1. while loop:
Execute the statement as long as the condition is true.

Syntax:

initialization of counter
while condition:
    statement or logic
    increment/ decrement counter

Example:5

i = 1
while i < 6:
  print(i)
  i += 1



The break Statement:

Example:6

i = 1
while i < 6:
  print(i)
  if i == 4:
    break
  i += 1




The continue Statement: 

Continue to the next iteration if the condition is true

Example:7

n = 0
while n < 6:
  n = n + 1
  if n == 3:
    continue
  print(n)



The else Statement

When the condition is no longer true at that time we can run the else statement

Example:8

i = 1
while i < 8:
  print(i)
  i += 1
else:
  print("i is no longer less than 8")


What is pass statement in Python?

To avoid the indentation error in Python we simply used pass in Python. now you doubt in mind why we get an indentation error, so let's check this code.



Example:1

x = 20
 
if x > 20:
    # write code your here
 
print('Hello all of you!')


output:

IndentationError: expected an indented block after 'if' statement

This is happen when the user does not know what code to write, So the user simply places a pass at that line. 

Sometimes, the pass is used when the user doesn’t want any code to execute. 

So users can simply place a pass where empty code is not allowed, 

like in loops, function definitions, class definitions, or in if statements. So using a pass statement user avoids this error.




Use of pass keyword in Function

Example:2

def addition():
  pass



Use of pass keyword in Python Class

Example:3

class studentClass:
  pass



Use of pass keyword in Conditional statement

Example:4

m = 10
n = 20
 
if(m<n):
  pass
else:
  print("n<m")



Use of pass keyword in Python Loop 

Example:5

list1 =['a1', 'b1', 'c1', 'd1']
 
for i in list1:
    if(i =='a1'):
        pass
    else:
        print(i)


2. for loop:
Execute the statement as long as the condition is true.

Syntax:

for x in range(10):
    # do something

The range() Function

To Iterate (loop) through a set of code a specified number of times, we can use the range() function,


Example:1

for x in range(6):
  print(x)
else:
  print("Finally finished!")




Example:2
The range() function defaults to 0 as a starting value, however, it is possible to specify the starting value by adding a parameter: range(2, 8), which means values from 2 to 6 (but not including 8):

for m in range(28):

  print(m)




Example:3

The range() function defaults to increment the sequence by 1, however it is

 possible to specify the increment value by adding a third parameter: range(3, 60, 3):

for x in range(3603):

  print(x)




Example:4


Note: 

The else block will not be executed if the for

 loop is stopped by the break keyword.


for m in range(8):

  if m == 4break

  print(m)

else:

  print("Finally finished!")




Python Collections (Arrays)

There are four collection data types in the Python

 programming language:

1.List:

- It is a collection which is ordered and changeable.  

- Allows duplicate members.

Example:

adj = ["red", "big", "tasty"]


fruits = ["apple", "banana", "cherry"]


for x in adj:

    for y in fruits:

        print(x,y)


2. Tuple:

- It is a collection which is ordered and

 unchangeable. 

- Allows duplicate members.

Example:

tuple2 = (15793)

print(tuple2)


3. Set :

- It is a collection which is unordered,

 unchangeable*, and unindexed. 

- No duplicate members.

- due to unordered you can not be sure in which

 order items appear in output.

Example:

set1 = {"abc"34True40"male"}

print(set1)


4. Dictionary 

- It is a collection which is ordered** and

 changeable. from 3.6 onwards unordered.

- No duplicate members.

Example:

thisdict1 = dict(name = "Joshi", age = 46, country = "India")

print(thisdict1)



Example:


thisdictstud = {

  "name""Ram",

  "age": 25,

  "class": "BE Comp"
}


print(thisdictstud["name"])

Expert Lecture on Python

 Unit no 1 Problem Solving, Programming and Python Programming

General Problem-Solving Concepts: 

Problem Solving in everyday life.

Having no problems is the
 biggest problem of all.

What is Problem?
problem is a situation that is unsatisfactory and causes difficulties for people and needs to be dealt with or solved.
For Example, let's See what is the Alberto's Problem? I like Problem Alway's

Problem Solving Steps:

The problem-solving process typically includes the following steps:

1. Identify the issue: Recognize the problem that needs to be solved.

2. Analyze the situation: Examine the issue in depth, gather all relevant information, and consider any limitations or constraints that may be present.

3. Generate potential solutions: Brainstorm a list of possible solutions to the issue, without immediately judging or evaluating them.

4. Evaluate options: Weigh the pros and cons of each potential solution, considering factors such as feasibility, effectiveness, and potential risks.

5. Select the best solution: Choose the option that best addresses the problem and aligns with your objectives.

6. Implement the solution: Put the selected solution into action and monitor the results to ensure it resolves the issue.

7. Review and learn: Reflect on the problem-solving process, identify any improvements or adjustments that can be made, and apply these learnings to future situations.

Program Design Tools: Algorithm, Flowchart, Pseudo-codes.

Data Structures

Basics of Python Programming:

1. Features of Python: Click here to learn features

2. History of Python: Click here to learn more

3. Literal Constants: click here to learn more.

4. Keyword (reserved word), Variables, and Identifiers: Click here to learn more


5. Data Types: click here to learn more

6. Input Operation in Python: Click here to Learn More

7. Indentation in Python: Click here to learn more..

8. Operators in Python: Click here to learn more

9. Expressions in python: Click here

 

Applications of Deep Learning

 Q. Explain common architectural principles of deep networks.





 Q. List the Application of Deep Learning.








Working-Application of DL

Q. What is the Learning representation of Data? or Feature learning or Representation Learning?






Q. How does deep learning work in three figures explain with an example.



























Wednesday, 14 February 2024

What is Deep Learning ?

Write a short note on the History of Deep Learning.














Define Deep Learning. Explain it's Pros and cons.









Tuesday, 6 February 2024

DataTypes

 Each variable in C has an associated data type. It specifies the type of data that the variable can store like integer, character, floating, double, etc. Each data type requires different amounts of memory and has some specific operations which can be performed over it. The data type is a collection of data with values having fixed values, meaning as well as its