This document discusses Python loops and string manipulation. It covers while loops, using a loop counter to repeat code a specified number of times. It also discusses slicing strings to access characters or substrings, checking if a string contains a character, and calling string methods like lower(), upper(), and replace() to manipulate strings.
First in the series of slides for python programming, covering topics like programming language, python programming constructs, loops and control statements.
Python Session - 4
if
nested-if
if-else
elif (else if)
for loop (for iterating_var in sequence: )
while loop
break
continnue
pass
What is a function in Python?
Types of Functions
How to Define & Call Function
Scope and Lifetime of variables
lambda functions(anonymous functions)
The document discusses different types of loops in Python including while loops, for loops, and infinite loops. It provides examples of using while loops to iterate until a condition is met, using for loops to iterate over a set of elements when the number of iterations is known, and how to terminate loops early using break or skip iterations using continue. It also discusses using the range() function to generate a sequence of numbers to iterate over in for loops.
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docxpriestmanmable
ISTA 130: Lab 2
1 Turtle Review
Here are all of the turtle functions we have utilized so far in this course:
turtle.forward(distance) – Moves the turtle forward in the direction it is currently facing the distance
entered
turtle.backward(distance) – Same as forward but it moves in the opposite direction the turtle is facing
turtle.right(degrees) – Roates the turtle to the right by the degrees enteres
turtle.left(degrees) – Same as right, but it rotates the turtle to the left
turtle.pensize(size) – Adjusts the size of the line left by the turtle to whatever value is entered for size
turtle.home() – Moves the turtle to the default location and faces it to the right
turtle.clear() – Clears all the lines that were left by the turtle in the window.
turtle.penup() – Causes the turtle to stop leaving lines (until pen is placed back down)
turtle.pendown() – Places the pen back down to the turtle can continue leaving lines when forward and
backward are called.
turtle.pencolor(color string) – Changes the color of the lines left by the turtle to whatever color string
entered (so long as Python recognizes it).
turtle.bgcolor(color string) – Changes the background color for the window that the turtle draws in.
turtle.speed(new speed) – Changes the speed at which the turtle moves to whatever newSpeed is.
turtle.clearscreen() – Deletes all drawings and turtles from the screen, leaving it in its initial state
Note that abbreviations also exist for many of these functions; for example:
� turtle.fd(distance)
� turtle.rt(degrees)
� turtle.pu()
1
2 Functions and Parameters
Here is the square function we looked at yesterday:
def square(side_length):
’’’
Draws a square given a numerical side_length
’’’
turtle.forward(side_length)
turtle.right(90)
turtle.forward(side_length)
turtle.right(90)
turtle.forward(side_length)
turtle.right(90)
turtle.forward(side_length)
turtle.right(90)
return
square(50) # This would give side_length the value of 50
square(100) # This would give side_length the value of 100
print side_length # This will give an error because side_length
# only exists inside the function!
Try it out:
(1 pt.) Create a new file called lab02.py. In this file, create a simple function called rhombus. It
will take one parameter, side length. Using this parameter, have your function create a rhombus
using turtle graphics. Call your rhombus function in the script. What happens if you provide no
arguments to the function? Two or three arguments?
Then, modify your rhombus function so it takes another argument for the angle inside the
rhombus.
3 Data types
Python recognizes many different types of values when working with data. These can be numbers,
strings of characters, or even user defined objects. For the time being, however, were only going to
focus on three of the data types:
integer – These are whole numbers, both positive and negative. Examples are 5000, 0, and -25
float – These are numbers that are followed by a decimal poi ...
This first assignment will focus on coding in Python, applying kno.docxabhi353063
This first assignment will focus on coding in Python, applying knowledge students should already have about programming with functions and arrays. When the assignment is complete, there will in fact be some indirect recursion, but that needs not complicate the assignment, if each function is allowed to assume that all other functions are implemented correctly.
Problem Description
Several years of experience in algebra probably yields a consistent interpretation of the expression
12 - 2 * 5 +3
Most would expect that the multiplication would be the first operation, followed by a subtraction, and then an addition, yielding a value of 5. Performing those three operations in any other order would yield very different results.
When a programmer places such an expression into a program, they would expect it to perform the same series of operations. The interpreter or compiler making sense of the expression then must be able to construct the correct meaning of the input. Often one will hear of this behavior called
parsing
.
Assignment Specifications
The input for this assignment will arrive as an instantiated
Python list
consisting of
tokens
, where each token is either an integer numeral or an operator. An additional symbol (such as a semicolon) will appear at the end of the list to mark the end of the input.
The Python list has a great deal in common with the C++ array, and this assignment will treat it as such. One will be able to use an integer subscript to examine each element of the list, just as one could examine consecutive array elements. The next assignment will use a different approach to visit the elements of the list.
Implementation Hints
One very simple method of parsing input is termed
predictive parsing
in which each function has an idea of what it expects to see next (or what alternatives it will encounter). For example, we would expect a numeric expression like the one above to include a series of values to be added or subtracted. Whether those values are explicit numbers (such as 12 and 3) or the results of other operations (such as 2*5) might sound like a complication, but that can just be addressed by some other function.
The pseudocode for parsing a sum expression would therefore look something like this:
to evaluate a sum expression (series of zero or more additions and subtractions): evaluate a product expression (zero or more multiplications and divisions) while the next token is a + or - operator evaluate the product expression that follows the operator perform the addition or subtraction
For the given example, the first product expression would simply be the value 12. This is followed by a minus sign, so the next product is evaluated to be 10, which is subtracted from 12 to yield 2. Since this is followed by a plus sign, the loop would repeat to evaluate and add the 3. No more operators appear, so the final result is 5.
The above specifications said that some other symbol would appear at the very end of the input. Thi ...
Operators and expressions are fundamental concepts in Python programming. The document discusses various types of operators used to manipulate operands, including arithmetic, comparison, assignment, logical, bitwise, and membership operators. It also covers expressions, which are combinations of operators and operands that evaluate to a value. Several types of expressions are described, such as constant, arithmetic, integral, floating, relational, logical, bitwise, and combinational expressions. Control flow statements like if, if-else, if-elif-else are also covered, along with looping using for and while loops and the break, continue, and pass statements.
This document discusses loops in R and when to use them versus vectorization. It provides examples of for, while, and repeat loops in R. The key points are:
- Loops allow repeating operations but can be inefficient; vectorization is preferred when possible.
- For loops execute a fixed number of times based on an index or counter. Nested for loops allow manipulating multi-dimensional arrays.
- While and repeat loops execute until a condition is met, but repeat ensures at least one iteration.
- Break and next statements allow interrupting loop iterations early.
This document provides an overview of key concepts for data science in Python, including popular Python packages like NumPy and Pandas. It introduces Python basics like data types, operators, and functions. It then covers NumPy topics such as arrays, slicing, splitting and reshaping arrays. It discusses Pandas Series and DataFrame data structures. Finally, it covers operations on missing data and combining datasets using merge and join functions.
The document provides an introduction and tutorial to the Python programming language. It covers 13 chapters that introduce very basic Python concepts up to more advanced topics like classes and CGI programming. The chapters include variables, data types, operators, conditionals, functions, iteration, strings, collection data types, exception handling, modules, files, documentation, and classes. The document also notes several sources that were used to create the tutorial and provides example code snippets throughout to demonstrate the concepts discussed.
This document provides lecture notes on dataflow analysis techniques. It introduces liveness analysis, neededness analysis, and reaching definitions analysis. Liveness analysis is extended to handle memory references. Neededness analysis is introduced to identify dead code by determining which variables are needed, rather than just live. Reaching definitions analysis is a forward dataflow analysis used for optimizations like constant propagation. Examples are provided and the analysis rules for each technique are specified.
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part 2Philip Schwarz
(download for perfect quality) See aggregation functions defined inductively and implemented using recursion.
Learn how in many cases, tail-recursion and the accumulator trick can be used to avoid stack-overflow errors.
Watch as general aggregation is implemented and see duality theorems capturing the relationship between left folds and right folds.
Through the work of Sergei Winitzki and Richard Bird.
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala Part 2 ...Philip Schwarz
The document discusses implementing aggregation functions inductively using recursion or folding. It explains that aggregation functions like sum, count, max can be defined inductively with a base case for empty sequences and a recursive step to process additional elements. Implementing functions recursively risks stack overflow for long inputs, but tail-recursion and accumulator tricks can help avoid this. Folds provide an alternative to recursion for defining aggregations by processing sequences from left to right or right to left.
This document provides an outline and overview of a presentation on learning Python for beginners. The presentation covers what Python is, why it is useful, how to install it and common editors used. It then discusses Python variables, data types, operators, strings, lists, tuples, dictionaries, conditional statements, looping statements and real-world applications. Examples are provided throughout to demonstrate key Python concepts and how to implement various features like functions, methods and control flow. The goal is to give attendees an introduction to the Python language syntax and capabilities.
Anton Kasyanov, Introduction to Python, Lecture2Anton Kasyanov
This document provides an introduction and overview of key concepts in Python, including variables, types, functions, and conditional statements. It discusses how variables store and reference values, Python's dynamic typing, and how functions are defined with the def keyword. Conditionals like if/else statements are explained, with the general form being an if conditional block followed by optional elif and else blocks. Homework involves implementing functions for logical operations, distance calculation, and percent calculation.
This document recaps topics covered in Week 1 of a coding initiative, including functions, modules, boolean expressions, relational operators, and conditional statements in Python. It provides examples and explanations of each topic, such as how functions have a header, body and can take parameters; how to import and use modules; how boolean expressions work with logical operators; and how to write conditional statements using if/elif/else.
This document discusses writing your own functions in Python. It begins by explaining that functions allow you to make code reusable and simplify programs. Functions take arguments, perform operations, and can return values. The document then provides examples of defining, calling, and returning values from functions. It highlights important aspects of functions like arguments, return statements, and scope.
This document outlines an introductory workshop on Python programming. It instructs participants to install Python and an editor, and assumes some programming knowledge. It provides overviews of Python's dynamic and object-oriented nature, basic constructs like conditionals and loops, built-in data types like lists and dictionaries, functions, classes, file I/O, and popular Python libraries and frameworks. Examples include FizzBuzz, word counting, and using list comprehensions.
This document discusses various Python operators and control flow statements. It covers operators like arithmetic, comparison, bitwise, and logical operators. It also discusses precedence rules for operators. For control flow, it explains if, while, for statements along with break, continue, else blocks. It provides examples of functions, parameters, default arguments, keyword arguments, local and global variables, and return statements.
Although people may be very accustomed to reading and understanding .docxmilissaccm
Although people may be very accustomed to reading and understanding calculations like those in the preceding assignments, it is evident they are not very self-evident or obvious in the world of computing. One way to simplify the problem is just to redefine how expressions are represented, to allow for simpler interpretation.
One knows that a plus sign means to add, but typically when a plus sign is encountered in the middle of an expression, there is not yet enough information to know what values are to be added. One has to continue scanning the expression to find the second operand, and also decide if there are other operations of higher precedence that must take place first. How much simpler it would be if a parser could know to add just as soon as the plus sign appears.
This is the motivation for a representation called
postfix
notation, in which all operators
follow
their operands. Here are some illustrations.
Infix Representation
Postfix Representation
Operations
(1 + 2) * 3
1 2 + 3 *
Add 1 and 2, then multiply by 3
1 + (2 * 3)
1 2 3 * +
Multiply 2 and 3, then add to 1
(1+2) * (6-4)
1 2 + 6 4 - *
Add 1 and 2, subtract 4 from 6, multiply
Hewlett Packard has produced a line of calculators that expected all inputs to be in postfix form, so every operation key could compute the moment it was pressed.
The goal of this assignment is to convert an infix expression into a postfix expression. This can be accomplished using the same algorithm as was used to evaluate the infix expression, simply yielding a new expression instead of a computed value. In the last example, instead of adding, it would produce an expression ending with a plus sign. The multiplication function would similarly produce an expression from its operands, followed by the multiplication operator.
Applying a Linked List
One of the purposes of this course is to find the data structures that would assist in producing the best results as efficiently as possible. The linked list is quite serviceable for the needs of this assignment.
A linked list will be useful in the calculation portion of this assignment. As the postfix expression is scanned, values must be saved until an operator is discovered. Each operator would apply to the two values that precede it, and then its result would also be saved. As an extreme example, consider this expression:
1 2 3 4 5 * - + - multiply 4 * 5, subtract from 3, add to 2, subtract from 1
Note this is not at all the same meaning as:
1 2 * 3 - 4 + 5 - or 4 5 * 3 - 2 + 1 -
(If you need to more clearly see the difference, try inserting parentheses around all operations, such that each parentheses consists of two expressions followed by an operator.)
Defining a Linked List
The linked list is a rather simple data structure, and the required operations should be rather simple, so very little will be said here about what to do. Instead, here is a quick highlight of what should appear in your implementation..
This document reviews basic programming concepts in Visual Basic such as variables, arrays, loops, and decisions. It provides examples of how to declare variables and constants, define arrays and loop through their elements, use different loop structures like While and For Each, and make decisions with If/Then/Else statements or Select Case. The goal is to refresh knowledge of these fundamentals before exploring more advanced Visual Basic topics in the course.
This document discusses loops in R and when to use them versus vectorization. It provides examples of for, while, and repeat loops in R. The key points are:
- Loops allow repeating operations but can be inefficient; vectorization is preferred when possible.
- For loops execute a fixed number of times based on an index or counter. Nested for loops allow manipulating multi-dimensional arrays.
- While and repeat loops execute until a condition is met, but repeat ensures at least one iteration.
- Break and next statements allow interrupting loop iterations early.
This document provides an overview of key concepts for data science in Python, including popular Python packages like NumPy and Pandas. It introduces Python basics like data types, operators, and functions. It then covers NumPy topics such as arrays, slicing, splitting and reshaping arrays. It discusses Pandas Series and DataFrame data structures. Finally, it covers operations on missing data and combining datasets using merge and join functions.
The document provides an introduction and tutorial to the Python programming language. It covers 13 chapters that introduce very basic Python concepts up to more advanced topics like classes and CGI programming. The chapters include variables, data types, operators, conditionals, functions, iteration, strings, collection data types, exception handling, modules, files, documentation, and classes. The document also notes several sources that were used to create the tutorial and provides example code snippets throughout to demonstrate the concepts discussed.
This document provides lecture notes on dataflow analysis techniques. It introduces liveness analysis, neededness analysis, and reaching definitions analysis. Liveness analysis is extended to handle memory references. Neededness analysis is introduced to identify dead code by determining which variables are needed, rather than just live. Reaching definitions analysis is a forward dataflow analysis used for optimizations like constant propagation. Examples are provided and the analysis rules for each technique are specified.
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala - Part 2Philip Schwarz
(download for perfect quality) See aggregation functions defined inductively and implemented using recursion.
Learn how in many cases, tail-recursion and the accumulator trick can be used to avoid stack-overflow errors.
Watch as general aggregation is implemented and see duality theorems capturing the relationship between left folds and right folds.
Through the work of Sergei Winitzki and Richard Bird.
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala Part 2 ...Philip Schwarz
The document discusses implementing aggregation functions inductively using recursion or folding. It explains that aggregation functions like sum, count, max can be defined inductively with a base case for empty sequences and a recursive step to process additional elements. Implementing functions recursively risks stack overflow for long inputs, but tail-recursion and accumulator tricks can help avoid this. Folds provide an alternative to recursion for defining aggregations by processing sequences from left to right or right to left.
This document provides an outline and overview of a presentation on learning Python for beginners. The presentation covers what Python is, why it is useful, how to install it and common editors used. It then discusses Python variables, data types, operators, strings, lists, tuples, dictionaries, conditional statements, looping statements and real-world applications. Examples are provided throughout to demonstrate key Python concepts and how to implement various features like functions, methods and control flow. The goal is to give attendees an introduction to the Python language syntax and capabilities.
Anton Kasyanov, Introduction to Python, Lecture2Anton Kasyanov
This document provides an introduction and overview of key concepts in Python, including variables, types, functions, and conditional statements. It discusses how variables store and reference values, Python's dynamic typing, and how functions are defined with the def keyword. Conditionals like if/else statements are explained, with the general form being an if conditional block followed by optional elif and else blocks. Homework involves implementing functions for logical operations, distance calculation, and percent calculation.
This document recaps topics covered in Week 1 of a coding initiative, including functions, modules, boolean expressions, relational operators, and conditional statements in Python. It provides examples and explanations of each topic, such as how functions have a header, body and can take parameters; how to import and use modules; how boolean expressions work with logical operators; and how to write conditional statements using if/elif/else.
This document discusses writing your own functions in Python. It begins by explaining that functions allow you to make code reusable and simplify programs. Functions take arguments, perform operations, and can return values. The document then provides examples of defining, calling, and returning values from functions. It highlights important aspects of functions like arguments, return statements, and scope.
This document outlines an introductory workshop on Python programming. It instructs participants to install Python and an editor, and assumes some programming knowledge. It provides overviews of Python's dynamic and object-oriented nature, basic constructs like conditionals and loops, built-in data types like lists and dictionaries, functions, classes, file I/O, and popular Python libraries and frameworks. Examples include FizzBuzz, word counting, and using list comprehensions.
This document discusses various Python operators and control flow statements. It covers operators like arithmetic, comparison, bitwise, and logical operators. It also discusses precedence rules for operators. For control flow, it explains if, while, for statements along with break, continue, else blocks. It provides examples of functions, parameters, default arguments, keyword arguments, local and global variables, and return statements.
Although people may be very accustomed to reading and understanding .docxmilissaccm
Although people may be very accustomed to reading and understanding calculations like those in the preceding assignments, it is evident they are not very self-evident or obvious in the world of computing. One way to simplify the problem is just to redefine how expressions are represented, to allow for simpler interpretation.
One knows that a plus sign means to add, but typically when a plus sign is encountered in the middle of an expression, there is not yet enough information to know what values are to be added. One has to continue scanning the expression to find the second operand, and also decide if there are other operations of higher precedence that must take place first. How much simpler it would be if a parser could know to add just as soon as the plus sign appears.
This is the motivation for a representation called
postfix
notation, in which all operators
follow
their operands. Here are some illustrations.
Infix Representation
Postfix Representation
Operations
(1 + 2) * 3
1 2 + 3 *
Add 1 and 2, then multiply by 3
1 + (2 * 3)
1 2 3 * +
Multiply 2 and 3, then add to 1
(1+2) * (6-4)
1 2 + 6 4 - *
Add 1 and 2, subtract 4 from 6, multiply
Hewlett Packard has produced a line of calculators that expected all inputs to be in postfix form, so every operation key could compute the moment it was pressed.
The goal of this assignment is to convert an infix expression into a postfix expression. This can be accomplished using the same algorithm as was used to evaluate the infix expression, simply yielding a new expression instead of a computed value. In the last example, instead of adding, it would produce an expression ending with a plus sign. The multiplication function would similarly produce an expression from its operands, followed by the multiplication operator.
Applying a Linked List
One of the purposes of this course is to find the data structures that would assist in producing the best results as efficiently as possible. The linked list is quite serviceable for the needs of this assignment.
A linked list will be useful in the calculation portion of this assignment. As the postfix expression is scanned, values must be saved until an operator is discovered. Each operator would apply to the two values that precede it, and then its result would also be saved. As an extreme example, consider this expression:
1 2 3 4 5 * - + - multiply 4 * 5, subtract from 3, add to 2, subtract from 1
Note this is not at all the same meaning as:
1 2 * 3 - 4 + 5 - or 4 5 * 3 - 2 + 1 -
(If you need to more clearly see the difference, try inserting parentheses around all operations, such that each parentheses consists of two expressions followed by an operator.)
Defining a Linked List
The linked list is a rather simple data structure, and the required operations should be rather simple, so very little will be said here about what to do. Instead, here is a quick highlight of what should appear in your implementation..
This document reviews basic programming concepts in Visual Basic such as variables, arrays, loops, and decisions. It provides examples of how to declare variables and constants, define arrays and loop through their elements, use different loop structures like While and For Each, and make decisions with If/Then/Else statements or Select Case. The goal is to refresh knowledge of these fundamentals before exploring more advanced Visual Basic topics in the course.
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITYijscai
With the increased use of Artificial Intelligence (AI) in malware analysis there is also an increased need to
understand the decisions models make when identifying malicious artifacts. Explainable AI (XAI) becomes
the answer to interpreting the decision-making process that AI malware analysis models use to determine
malicious benign samples to gain trust that in a production environment, the system is able to catch
malware. With any cyber innovation brings a new set of challenges and literature soon came out about XAI
as a new attack vector. Adversarial XAI (AdvXAI) is a relatively new concept but with AI applications in
many sectors, it is crucial to quickly respond to the attack surface that it creates. This paper seeks to
conceptualize a theoretical framework focused on addressing AdvXAI in malware analysis in an effort to
balance explainability with security. Following this framework, designing a machine with an AI malware
detection and analysis model will ensure that it can effectively analyze malware, explain how it came to its
decision, and be built securely to avoid adversarial attacks and manipulations. The framework focuses on
choosing malware datasets to train the model, choosing the AI model, choosing an XAI technique,
implementing AdvXAI defensive measures, and continually evaluating the model. This framework will
significantly contribute to automated malware detection and XAI efforts allowing for secure systems that
are resilient to adversarial attacks.
π0.5: a Vision-Language-Action Model with Open-World GeneralizationNABLAS株式会社
今回の資料「Transfusion / π0 / π0.5」は、画像・言語・アクションを統合するロボット基盤モデルについて紹介しています。
拡散×自己回帰を融合したTransformerをベースに、π0.5ではオープンワールドでの推論・計画も可能に。
This presentation introduces robot foundation models that integrate vision, language, and action.
Built on a Transformer combining diffusion and autoregression, π0.5 enables reasoning and planning in open-world settings.
its all about Artificial Intelligence(Ai) and Machine Learning and not on advanced level you can study before the exam or can check for some information on Ai for project
Fluid mechanics is the branch of physics concerned with the mechanics of fluids (liquids, gases, and plasmas) and the forces on them. Originally applied to water (hydromechanics), it found applications in a wide range of disciplines, including mechanical, aerospace, civil, chemical, and biomedical engineering, as well as geophysics, oceanography, meteorology, astrophysics, and biology.
It can be divided into fluid statics, the study of various fluids at rest, and fluid dynamics.
Fluid statics, also known as hydrostatics, is the study of fluids at rest, specifically when there's no relative motion between fluid particles. It focuses on the conditions under which fluids are in stable equilibrium and doesn't involve fluid motion.
Fluid kinematics is the branch of fluid mechanics that focuses on describing and analyzing the motion of fluids, such as liquids and gases, without considering the forces that cause the motion. It deals with the geometrical and temporal aspects of fluid flow, including velocity and acceleration. Fluid dynamics, on the other hand, considers the forces acting on the fluid.
Fluid dynamics is the study of the effect of forces on fluid motion. It is a branch of continuum mechanics, a subject which models matter without using the information that it is made out of atoms; that is, it models matter from a macroscopic viewpoint rather than from microscopic.
Fluid mechanics, especially fluid dynamics, is an active field of research, typically mathematically complex. Many problems are partly or wholly unsolved and are best addressed by numerical methods, typically using computers. A modern discipline, called computational fluid dynamics (CFD), is devoted to this approach. Particle image velocimetry, an experimental method for visualizing and analyzing fluid flow, also takes advantage of the highly visual nature of fluid flow.
Fundamentally, every fluid mechanical system is assumed to obey the basic laws :
Conservation of mass
Conservation of energy
Conservation of momentum
The continuum assumption
For example, the assumption that mass is conserved means that for any fixed control volume (for example, a spherical volume)—enclosed by a control surface—the rate of change of the mass contained in that volume is equal to the rate at which mass is passing through the surface from outside to inside, minus the rate at which mass is passing from inside to outside. This can be expressed as an equation in integral form over the control volume.
The continuum assumption is an idealization of continuum mechanics under which fluids can be treated as continuous, even though, on a microscopic scale, they are composed of molecules. Under the continuum assumption, macroscopic (observed/measurable) properties such as density, pressure, temperature, and bulk velocity are taken to be well-defined at "infinitesimal" volume elements—small in comparison to the characteristic length scale of the system, but large in comparison to molecular length scale
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...Infopitaara
A Boiler Feed Pump (BFP) is a critical component in thermal power plants. It supplies high-pressure water (feedwater) to the boiler, ensuring continuous steam generation.
⚙️ How a Boiler Feed Pump Works
Water Collection:
Feedwater is collected from the deaerator or feedwater tank.
Pressurization:
The pump increases water pressure using multiple impellers/stages in centrifugal types.
Discharge to Boiler:
Pressurized water is then supplied to the boiler drum or economizer section, depending on design.
🌀 Types of Boiler Feed Pumps
Centrifugal Pumps (most common):
Multistage for higher pressure.
Used in large thermal power stations.
Positive Displacement Pumps (less common):
For smaller or specific applications.
Precise flow control but less efficient for large volumes.
🛠️ Key Operations and Controls
Recirculation Line: Protects the pump from overheating at low flow.
Throttle Valve: Regulates flow based on boiler demand.
Control System: Often automated via DCS/PLC for variable load conditions.
Sealing & Cooling Systems: Prevent leakage and maintain pump health.
⚠️ Common BFP Issues
Cavitation due to low NPSH (Net Positive Suction Head).
Seal or bearing failure.
Overheating from improper flow or recirculation.
Concept of Problem Solving, Introduction to Algorithms, Characteristics of Algorithms, Introduction to Data Structure, Data Structure Classification (Linear and Non-linear, Static and Dynamic, Persistent and Ephemeral data structures), Time complexity and Space complexity, Asymptotic Notation - The Big-O, Omega and Theta notation, Algorithmic upper bounds, lower bounds, Best, Worst and Average case analysis of an Algorithm, Abstract Data Types (ADT)
International Journal of Distributed and Parallel systems (IJDPS)samueljackson3773
The growth of Internet and other web technologies requires the development of new
algorithms and architectures for parallel and distributed computing. International journal of
Distributed and parallel systems is a bimonthly open access peer-reviewed journal aims to
publish high quality scientific papers arising from original research and development from
the international community in the areas of parallel and distributed systems. IJDPS serves
as a platform for engineers and researchers to present new ideas and system technology,
with an interactive and friendly, but strongly professional atmosphere.
Passenger car unit (PCU) of a vehicle type depends on vehicular characteristics, stream characteristics, roadway characteristics, environmental factors, climate conditions and control conditions. Keeping in view various factors affecting PCU, a model was developed taking a volume to capacity ratio and percentage share of particular vehicle type as independent parameters. A microscopic traffic simulation model VISSIM has been used in present study for generating traffic flow data which some time very difficult to obtain from field survey. A comparison study was carried out with the purpose of verifying when the adaptive neuro-fuzzy inference system (ANFIS), artificial neural network (ANN) and multiple linear regression (MLR) models are appropriate for prediction of PCUs of different vehicle types. From the results observed that ANFIS model estimates were closer to the corresponding simulated PCU values compared to MLR and ANN models. It is concluded that the ANFIS model showed greater potential in predicting PCUs from v/c ratio and proportional share for all type of vehicles whereas MLR and ANN models did not perform well.
We introduce the Gaussian process (GP) modeling module developed within the UQLab software framework. The novel design of the GP-module aims at providing seamless integration of GP modeling into any uncertainty quantification workflow, as well as a standalone surrogate modeling tool. We first briefly present the key mathematical tools on the basis of GP modeling (a.k.a. Kriging), as well as the associated theoretical and computational framework. We then provide an extensive overview of the available features of the software and demonstrate its flexibility and user-friendliness. Finally, we showcase the usage and the performance of the software on several applications borrowed from different fields of engineering. These include a basic surrogate of a well-known analytical benchmark function; a hierarchical Kriging example applied to wind turbine aero-servo-elastic simulations and a more complex geotechnical example that requires a non-stationary, user-defined correlation function. The GP-module, like the rest of the scientific code that is shipped with UQLab, is open source (BSD license).
The role of the lexical analyzer
Specification of tokens
Finite state machines
From a regular expressions to an NFA
Convert NFA to DFA
Transforming grammars and regular expressions
Transforming automata to grammars
Language for specifying lexical analyzers
2. If, elif, else statement
Bibek Kumar-Assistant Professor-CSE,
KIET
if Statements in Python allows us to tell the computer to perform alternative actions based on a
certain set of results.
Verbally, we can imagine we are telling the computer:
"Hey if this case happens, perform some action"
We can then expand the idea further with elif and else statements, which allow us to tell the
computer:
"Hey if this case happens, perform some action. Else, if another case happens, perform some other
action. Else, if none of the above cases happened, perform this action."
if case1:
perform action1
elif case2:
perform
action2
else:
perform
action3
Syntax
If the condition "condition_1" is True, the statements of the block
statement_block_1 will be executed. If not, condition_2 will be
evaluated. If condition_2 evaluates to True, statement_block_2 will
be executed, if condition_2 is False, the other conditions of the
following elif conditions will be checked, and finally if none of them
has been evaluated to True, the indented block below the else
keyword will be executed.
3. Bibek Kumar-Assistant Professor-CSE,
KIET
The if, elif and else Statements
Examples Multiple Branches
Note how the nested if statements are each checked until a True
Boolean causes the nested code below it to run. We should also
note that we can put in as many elif statements as we want
before we close off with an else.
4. While
Bibek Kumar-Assistant Professor-CSE,
KIET
The while statement in Python is one of most general ways to perform
iteration. A while statement will repeatedly execute a single statement or
group of statements as long as the condition is true. The reason it is called a
'loop' is because the code statements are looped through over and over
again until the condition is no longer met.
while test:
code statements
else:
final code statements
Syntax
Notice how many times the print statements
occurred and how the while loop kept going until
the True condition was met, which occurred once
x==10. It's important to note that once this
occurred the code stopped.
5. While Loops
We can also add else statement in the loop as shown
When the loop completes, the else statement is read
5
6. While Loops
We can use break, continue, and pass statements in our loops to add additional functionality for
various cases. The three statements are defined by:
• break: Breaks out of the current closest enclosing loop.
• continue: Goes to the top of the closest enclosing loop.
• pass: Does nothing at all.
Syntax:
while test:
code
statement
if test:
break
if test:
continue
else:
break and continue statements can appear anywhere inside the loop’s body, but we will usually
put them further nested in conjunction with an if statement to perform an action based on some
condition.
A word of caution however! It is possible to create an
infinitely running loop with while statements.
6
7. A for loop acts as an iterator in Python; it goes through items
that are in a sequence or any other iterable item. Objects that
we've learned about that we can iterate over include strings,
lists, tuples, and even built-in iterables for dictionaries, such as
keys or values.
for item in object:
statements to do
stuff
Example
Let's print only the even numbers from that list!
We could have also put an else statement in there
7
For loop
8. Using the for Statement
Another common idea during a for loop is keeping some sort of
running tally during multiple loops
We've used for loops with lists, how about with strings?
Remember strings are a sequence so when we iterate through
them we will be accessing each item in that string.
Let's now look at how a for loop can be used with a tuple
Tuples are very similar to lists, however, unlike lists they are
immutable meaning they can not be changed. You would use
tuples to present things that shouldn't be changed, such as days
of the week, or dates on a calendar.
The construction of a tuples use () with elements separated by
commas.
8
9. Using the for Statement
Tuples have a special quality when it comes to for loops. If you
are iterating through a sequence that contains tuples, the item
can actually be the tuple itself, this is an example of tuple
unpacking. During the for loop we will be unpacking the tuple
inside of a sequence and we can access the individual items
inside that tuple!
Iterating through Dictionaries
9
10. Break statement
• Used to terminate the execution of the nearest enclosing loop .
• It is widely used with for and while loop
Example
I = 1
while I <= 10:
print(I, end=“ “)
if I==5:
break
I = I+1
Print (“Out from while loop”)
10
11. Continue statement
• The Continue statement is used to skip the rest of the code inside a
loop for the current iteration only. Loop does not terminate but
continues on with the next iteration.
Example
for val in "string":
if val == "i":
continue
print(val)
print("The end")
11
12. Range() function
12
The range() is an in-built function in Python. It returns a sequence of
numbers starting from zero and increment by 1 by default and stops
before the given number.
x = range(5)
for n in x:
print(n)
Example : range(5) will start from 0 and end at 4.
range(start, stop, step)
13. Range() function
13
Along with loops, range() is also used to iterate over the list types using
the len function and access the values through the index
Example
listType = ['US', 'UK', 'India', 'China']
for i in range(len(listType)):
print(listType[i])
Reverse Range
• We can give either positive or negative numbers for any of the
parameters in the range.
• This feature offers the opportunity to implement reverse loops.
• We can do this by passing a higher index as a start and a negative step
value.
for i in range(10, 5, -1):
print(i) #OutPut : 10, 9, 8, 7, 6
14. Range() function
14
Create List, Set and Tuple using Range
range() comes handy in many situations, rather than only using to write
loops.
For example, we create List, Set, and Tuple using range function instead of
using loops to avoid boilerplate code.
Example:
print(list(range(0, 10, 2)))
print(set(range(0, 10, 2)))
print(tuple(range(0, 10, 2)))
print(list(range(10, 0, -2)))
print(tuple(range(10, 0, -2)))
15. pass statement
•In Python programming, pass is a null statement.
•The difference between a comment and pass statement in Python is that,
while the interpreter ignores a comment entirely, pass is not ignored.
•However, nothing happens when pass is executed. It results into no
operation (NOP).
•Suppose we have a loop or a function that is not implemented yet, but we
want to implement it in the future. They cannot have an empty body. So, we
use the pass statement to construct a body that does nothing.
•Example
sequence = {‘p’, ‘a’, ‘s’, ‘s’}
for val in sequence:
pass
16. Lambda OR Anonymous function
They are not declared as normal function.
They do not required def keyword but they are declared with a lambda
keyword.
Lambda function feature added to python due to
Demand from LISP programmers.
Syntax: lambda argument1,argument2,….argumentN: expression
Example:
Sum = lambda x,y : x+y
17. Program:
Program that passes lambda function as an argument to a function
def func(f, n):
print(f(n))
Twice = lambda x:x *2
Thrice = lambda y:y*3
func(Twice, 5)
func(Thrice,6)
Output: 10
18
18. Functional programming decomposes a problem into set of functions.
1. filter( )
This function is responsible to construct a list from those elements of the list
for which a function returns True.
Syntax: filter (function, sequence)
Example:
def check(x):
if(x%2==0 or x%4==0):
return 1
evens = list(check, range(2,22))
print(evens)
O/P: [2,4,6,8…….16,18,20]
Functional Programming
19. 2. map():
It applies a particular function to every element of a list.
Its syntax is similar to filter function
After apply the specified function on the sequence the map() function
return the modified list.
map(function, sequence)
Example:
def mul_2(x):
x*=2
return x
num_list = [1,2,3,4,5,6,7]
New_list = list(map(mul_2, num_list)
Print(New_list)
Functional Programming
20. 2. reduce():
It returns a single value generated by calling the function on the first two
items of the sequence then on result and the next item, and so on.
Syntax: reduce(function, sequence)
Example:
import functools
def add(a,b):
return x,y
num_list = [1,2,3,4,5]
print(functools.reduce(add, num_list))
Functional Programming
21. List comprehension offers a shorter syntax when we want to create a new list
Based on the values of an existing list.
Example
Fruits = [“apple”, “banana”, “cherry”, “kiwi”, “mango”]
newlist = [ ]
for x in Fruits:
if “a” in x:
newlist.append(x)
Print(newlist)
List Comprehension
With list comprehension it
can do with one statement
Newlist = [x for x in fruits if
“a” in x]
Syntax:
Newlist = [expression for item in
iterable if condition = = true]
Only accept items that are not
apple
Newlist = [x for x in fruits if
x!=“apple”]
22. Strings
•A string is a sequence of characters.
•Computers do not deal with characters, they deal with numbers (binary).
Even though you may see characters on your screen, internally it is stored
and manipulated as a combination of 0’s and 1’s.
•How to create a string?
•Strings can be created by enclosing characters inside a single quote or
double quotes.
•Even triple quotes can be used in Python but generally used to represent
multiline strings and docstrings.
myString = ‘Hello’
print(myString) myString = "Hello"
print(myString) myString = ‘’’Hello’’’
print(myString)
23. How to access characters in a string?
myString = "Hello"
#print first Character
print(myString[0])
#print last character using negative indexing
print(myString[-1])
#slicing 2nd to 5th character
print(myString[2:5])
#print reverse of string
print(myString[::-1])
How to change or delete a string ?
•Strings are immutable.
•We cannot delete or remove characters from a string. But deleting the
string entirely is possible using the keyword del.
24. String Operations
•Concatenation
s1 = "Hello "
s2 = “KNMIET"
#concatenation of 2 strings
print(s1 + s2)
#repeat string n times
print(s1 * 3)
•Iterating Through String
count = 0
for l in "Hello World":
if l == "o":
count += 1
print(count, " letters found")
25. String Membership Test
•To check whether given character or string is present or not.
•For example-
print("l" in "Hello World")
print("or" in "Hello World")
•String Methods
•lower()
•join()
•split()
•upper()
26. Python Program to Check whether a String is
Palindrome or not ?
myStr = "Madam"
#convert entire string to either lower or upper
myStr = myStr.lower()
#reverse string
revStr = myStr[::-1]
#check if the string is equal to its reverse
if myStr == revStr:
print("Given String is palindrome")
else:
print("Given String is not palindrome")
27. Python Program to Sort Words in Alphabetic Order?
myStr = "python Program to Sort words in Alphabetic Order"
#breakdown the string into list of words
words = myStr.split()
#sort the list
words.sort()
#printing Sorted words
for word in words:
print(word)