In this PPT you learn some basic terminology and basic concept of Python which is a pillar of python programming.So learn Python programming by these PPT.
You get a new presentation every Sunday at 10 AM.
The document provides an introduction to programming in Python. It discusses how Python can be used for web development, desktop applications, data science, machine learning, and more. It also covers executing Python programs, reading keyboard input, decision making and loops in Python, standard data types like numbers, strings, lists, tuples and dictionaries. Additionally, it describes functions, opening and reading/writing files, regular expressions, and provides examples of SQLite database connections in Python projects.
Python is a general purpose programming language created by Guido van Rossum in 1991. It is an interpreted, interactive, object-oriented language with a simple syntax. Python supports cross-platform development and is widely used for scripting, game development, and building desktop and mobile applications. To use Python, developers must download the Python interpreter and can write and run code using the interactive shell or integrated development environments like IDLE. The document then discusses Python's multi-paradigm programming style, advantages like rapid development, and how to install Python and write basic programs using variables, operators, and data types.
This document provides an overview of the basics of the Python programming language. It discusses Python's history and features, data types like numbers, strings, lists, tuples and dictionaries. It also covers Python concepts like variables, operators, control flow statements and functions. Specific topics covered include Python interpreters, comments, variables and scopes, data structures, conditional statements like if/else, and exceptions handling.
Here are the answers to the exercises:
1. The len() method is used to find the length of a string.
2. To get the first character of the string txt, it would be:
txt="hello"
x=txt[0]
3. The strip() method removes any whitespace from the beginning or the end of a string.
Introduction To Programming with PythonSushant Mane
The document provides an introduction to the Python programming language. It discusses Python's core features like being an interpreted, object-oriented, and dynamic language. It covers basic Python concepts like data types, variables, operators, control flow, functions, modules, file handling, and object-oriented programming. The document contains examples and explanations of built-in types like numbers, strings, lists, tuples, and dictionaries. It also discusses control structures, functions, modules, and classes in Python.
The document provides an overview of the Python programming language. It discusses why Python is useful for students and professionals, its major features like being object-oriented and having a large standard library. The document also covers Python's history, how to install it and set the environment variables, basic syntax like variables and data types, operators, and common programming constructs like conditionals and loops.
Python-04| Fundamental data types vs immutabilityMohd Sajjad
Fundamental data types like integers, floats, booleans and strings are immutable in Python. Immutable means the object cannot be changed once created. For integers from 0 to 256, Python reuses the same integer objects to save memory. It also reuses the two boolean objects for True and False. For strings, a new object is created each time due to the large number of possible string values. Floats and complexes are also immutable and do not reuse objects. Immutability helps improve performance and memory usage in Python.
This Presentation Helps for the beginners to understand easily Python Programming Language, because i had given an snapshot of each concepts. Those who are knowing C,C++ and Java they can easily understand my presentation.
This document provides an introduction and overview of the Python programming language. It discusses Python's features such as being simple, easy to learn, free and open source, portable, and having batteries included. It also covers installing Python, writing a simple "Hello World" program, using variables and data types, operators, control flow statements, functions, and various Python data structures like lists, tuples, and dictionaries. The document is intended to teach beginners the basics of Python.
This document provides an introduction to Python fundamentals, including:
1. The Python character set includes letters, digits, symbols, and whitespace. Individual elements are called tokens or lexical units.
2. Keywords, identifiers, literals, operators, and punctuators are the main types of tokens. Identifiers follow specific naming conventions. Literals include strings, numbers, Booleans, None, and collections.
3. Strings can be single or multi-line with escape sequences. Numbers can be integers, floats, or complex. True, False, and None are Boolean and special literals.
The document provides an introduction to Python programming. It discusses key concepts like variables, data types, operators, and sequential data types. Python is presented as an interpreted programming language that uses indentation to indicate blocks of code. Comments and documentation are included to explain the code. Various data types are covered, including numbers, strings, booleans, and lists. Operators for arithmetic, comparison, assignment and more are also summarized.
Python supports four main numerical types - integers, long integers, floating point numbers, and complex numbers. It provides various functions for mathematical, random number, trigonometric operations and constants like pi and e. Numbers are immutable and created using literals or by assigning values. The del statement can delete single or multiple number references.
This document introduces Python and provides an overview of its key features. It discusses Python's history and design philosophy, covers basic syntax like variables, expressions, conditionals and loops. It also summarizes Python's core datatypes like strings, lists, dictionaries and files. The document is intended to give readers a high-level understanding of Python for the purposes of an introductory talk or seminar on the language.
All data values in Python are encapsulated in relevant object classes. Everything in Python is an object and every object has an identity, a type, and a value. Like another object-oriented language such as Java or C++, there are several data types which are built into Python. Extension modules which are written in C, Java, or other languages can define additional types.
To determine a variable's type in Python you can use the type() function. The value of some objects can be changed. Objects whose value can be changed are called mutable and objects whose value is unchangeable (once they are created) are called immutable.
This document discusses basic data types in Python, including numeric, sequence, boolean, and dictionary types. It provides examples and explanations of integer, float, complex, string, list, tuple, set, and dictionary data types. Numeric types represent numeric values, sequence types organize ordered sequences, boolean represents True or False, and dictionary stores key-value pairs. Python assigns data types dynamically based on values and allows flexible conversion between types.
Introduction to the basics of Python programming (part 3)Pedro Rodrigues
This is the 3rd part of a multi-part series that teaches the basics of Python programming. It covers list and dict comprehensions, functions, modules and packages.
Esoft Metro Campus - Diploma in Information Technology - (Module VIII) Programming with Java
(Template - Virtusa Corporate)
Contents:
Introduction to Java
Features of Java
What you can create by Java?
Start Java Programming
Creating First Java Program
Java Virtual Machine
Basic Rules to Remember
Keywords in Java
Comments in Java Programs
Printing Statements
Primitive Data Types in Java
Arithmetic Operators
Assignment Operators
Comparison Operators
Logical Operators
If Statement
If… Else Statement
If… Else if… Else Statement
Nested If Statement
While Loop
Do While Loop
For Loop
Reading User Input
Arrays
Two Dimensional Arrays
Objects and Classes
Java Classes
Java Objects
Methods with Return Value
Methods without Return Value
Method Overloading
Variable Types
Inheritance
Method Overriding
Access Modifiers
Packages
GUI Applications in Java
Java Applets
Python Session - 2
Install Python
Run Python
Python Keyword
Python Identifiers
Python Variables
Python Literals
Python Comments
By default Python installed on following path in Windows
C:\Users\user\AppData\Local\Programs\Python\Python37
Removing the MAX_PATH Limitation :
Windows historically has limited path lengths to 260 characters. This meant that paths longer than this would not resolve and errors would result.
In the latest versions of Windows, this limitation can be expanded to approximately 32,000 characters. Your administrator will need to activate the “Enable Win32 long paths” group policy, or set the registry value HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem@LongPathsEnabled to 1.
Basic concept of Python.pptx includes design tool, identifier, variables.supriyasarkar38
This document discusses Python programming concepts including data types, variables, operators, and functions. It provides examples of Python syntax for writing and executing code as well as built-in data types like strings, integers, and lists. Key concepts covered include variables, data type casting, comments, arithmetic and comparison operators, and functions.
Python is a popular programming language. It was created by Guido van Rossum, and released in 1991.
It is used for:
- web development (server-side),
- software development,
- mathematics,
- system scripting.
What can Python do?
Python can be used on a server to create web applications.
Python can be used alongside software to create workflows.
Python can connect to database systems. It can also read and modify files.
Python can be used to handle big data and perform complex mathematics.
Python can be used for rapid prototyping, or for production-ready software development.
- Why Python?
Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).
Python has a simple syntax similar to the English language.
Python has syntax that allows developers to write programs with fewer lines than some other programming languages.
Python runs on an interpreter system, meaning that code can be executed as soon as it is written. This means that prototyping can be very quick.
Python can be treated in a procedural way, an object-oriented way or a functional way.
- what we learn:
1- Python Install.
2- Python Comments.
3- Python Variables.
4- Python Data Types.
5- Python Numbers.
Introduction To Programming with PythonSushant Mane
The document provides an introduction to the Python programming language. It discusses Python's core features like being an interpreted, object-oriented, and dynamic language. It covers basic Python concepts like data types, variables, operators, control flow, functions, modules, file handling, and object-oriented programming. The document contains examples and explanations of built-in types like numbers, strings, lists, tuples, and dictionaries. It also discusses control structures, functions, modules, and classes in Python.
The document provides an overview of the Python programming language. It discusses why Python is useful for students and professionals, its major features like being object-oriented and having a large standard library. The document also covers Python's history, how to install it and set the environment variables, basic syntax like variables and data types, operators, and common programming constructs like conditionals and loops.
Python-04| Fundamental data types vs immutabilityMohd Sajjad
Fundamental data types like integers, floats, booleans and strings are immutable in Python. Immutable means the object cannot be changed once created. For integers from 0 to 256, Python reuses the same integer objects to save memory. It also reuses the two boolean objects for True and False. For strings, a new object is created each time due to the large number of possible string values. Floats and complexes are also immutable and do not reuse objects. Immutability helps improve performance and memory usage in Python.
This Presentation Helps for the beginners to understand easily Python Programming Language, because i had given an snapshot of each concepts. Those who are knowing C,C++ and Java they can easily understand my presentation.
This document provides an introduction and overview of the Python programming language. It discusses Python's features such as being simple, easy to learn, free and open source, portable, and having batteries included. It also covers installing Python, writing a simple "Hello World" program, using variables and data types, operators, control flow statements, functions, and various Python data structures like lists, tuples, and dictionaries. The document is intended to teach beginners the basics of Python.
This document provides an introduction to Python fundamentals, including:
1. The Python character set includes letters, digits, symbols, and whitespace. Individual elements are called tokens or lexical units.
2. Keywords, identifiers, literals, operators, and punctuators are the main types of tokens. Identifiers follow specific naming conventions. Literals include strings, numbers, Booleans, None, and collections.
3. Strings can be single or multi-line with escape sequences. Numbers can be integers, floats, or complex. True, False, and None are Boolean and special literals.
The document provides an introduction to Python programming. It discusses key concepts like variables, data types, operators, and sequential data types. Python is presented as an interpreted programming language that uses indentation to indicate blocks of code. Comments and documentation are included to explain the code. Various data types are covered, including numbers, strings, booleans, and lists. Operators for arithmetic, comparison, assignment and more are also summarized.
Python supports four main numerical types - integers, long integers, floating point numbers, and complex numbers. It provides various functions for mathematical, random number, trigonometric operations and constants like pi and e. Numbers are immutable and created using literals or by assigning values. The del statement can delete single or multiple number references.
This document introduces Python and provides an overview of its key features. It discusses Python's history and design philosophy, covers basic syntax like variables, expressions, conditionals and loops. It also summarizes Python's core datatypes like strings, lists, dictionaries and files. The document is intended to give readers a high-level understanding of Python for the purposes of an introductory talk or seminar on the language.
All data values in Python are encapsulated in relevant object classes. Everything in Python is an object and every object has an identity, a type, and a value. Like another object-oriented language such as Java or C++, there are several data types which are built into Python. Extension modules which are written in C, Java, or other languages can define additional types.
To determine a variable's type in Python you can use the type() function. The value of some objects can be changed. Objects whose value can be changed are called mutable and objects whose value is unchangeable (once they are created) are called immutable.
This document discusses basic data types in Python, including numeric, sequence, boolean, and dictionary types. It provides examples and explanations of integer, float, complex, string, list, tuple, set, and dictionary data types. Numeric types represent numeric values, sequence types organize ordered sequences, boolean represents True or False, and dictionary stores key-value pairs. Python assigns data types dynamically based on values and allows flexible conversion between types.
Introduction to the basics of Python programming (part 3)Pedro Rodrigues
This is the 3rd part of a multi-part series that teaches the basics of Python programming. It covers list and dict comprehensions, functions, modules and packages.
Esoft Metro Campus - Diploma in Information Technology - (Module VIII) Programming with Java
(Template - Virtusa Corporate)
Contents:
Introduction to Java
Features of Java
What you can create by Java?
Start Java Programming
Creating First Java Program
Java Virtual Machine
Basic Rules to Remember
Keywords in Java
Comments in Java Programs
Printing Statements
Primitive Data Types in Java
Arithmetic Operators
Assignment Operators
Comparison Operators
Logical Operators
If Statement
If… Else Statement
If… Else if… Else Statement
Nested If Statement
While Loop
Do While Loop
For Loop
Reading User Input
Arrays
Two Dimensional Arrays
Objects and Classes
Java Classes
Java Objects
Methods with Return Value
Methods without Return Value
Method Overloading
Variable Types
Inheritance
Method Overriding
Access Modifiers
Packages
GUI Applications in Java
Java Applets
Python Session - 2
Install Python
Run Python
Python Keyword
Python Identifiers
Python Variables
Python Literals
Python Comments
By default Python installed on following path in Windows
C:\Users\user\AppData\Local\Programs\Python\Python37
Removing the MAX_PATH Limitation :
Windows historically has limited path lengths to 260 characters. This meant that paths longer than this would not resolve and errors would result.
In the latest versions of Windows, this limitation can be expanded to approximately 32,000 characters. Your administrator will need to activate the “Enable Win32 long paths” group policy, or set the registry value HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem@LongPathsEnabled to 1.
Basic concept of Python.pptx includes design tool, identifier, variables.supriyasarkar38
This document discusses Python programming concepts including data types, variables, operators, and functions. It provides examples of Python syntax for writing and executing code as well as built-in data types like strings, integers, and lists. Key concepts covered include variables, data type casting, comments, arithmetic and comparison operators, and functions.
Python is a popular programming language. It was created by Guido van Rossum, and released in 1991.
It is used for:
- web development (server-side),
- software development,
- mathematics,
- system scripting.
What can Python do?
Python can be used on a server to create web applications.
Python can be used alongside software to create workflows.
Python can connect to database systems. It can also read and modify files.
Python can be used to handle big data and perform complex mathematics.
Python can be used for rapid prototyping, or for production-ready software development.
- Why Python?
Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).
Python has a simple syntax similar to the English language.
Python has syntax that allows developers to write programs with fewer lines than some other programming languages.
Python runs on an interpreter system, meaning that code can be executed as soon as it is written. This means that prototyping can be very quick.
Python can be treated in a procedural way, an object-oriented way or a functional way.
- what we learn:
1- Python Install.
2- Python Comments.
3- Python Variables.
4- Python Data Types.
5- Python Numbers.
This document provides an introduction and overview of the Python programming language. It discusses Python's key features such as being an interpreted, object-oriented, high-level programming language with dynamic typing and a large standard library. It also covers Python's use as both a scripting and general purpose language. The document then discusses Python's data types, operators, control flow statements, functions, and lambda expressions. It provides examples of using Python interactively and in script mode.
Python (Data Analysis) cleaning and visualizeIruolagbePius
This document provides an overview of Python programming language. It discusses Python features, uses, variables, data types, operators, decision making statements, and loops. Specifically, it covers:
- Python features like being easy to learn and read, having an interactive mode, and being portable.
- Python variables, naming rules, and basic data types like numbers, strings, booleans.
- Operators for arithmetic, comparison, assignment, and logic.
- Conditional statements like if, elif, else for decision making.
- Looping structures like while and for loops, with examples of using break, continue, else, range().
- How to write comments, take user input, and
Python is an interpreted, object-oriented, high-level programming language with dynamic typing and dynamic binding. Its simple, easy to learn syntax emphasizes readability and it uses significant indentation to delimit code blocks rather than curly braces or keywords. Python supports modules and packages, which encourages program modularity and code reuse. It also has a large standard library.
The document discusses Python programming language. It provides an overview of what Python is, what it can be used for, and why it is a popular language. Specifically, it notes that Python was created by Guido van Rossum and released in 1991. It is used for web development, software development, mathematics, and system scripting. The document then covers Python syntax, basic data types, operators, decision making and control flow statements like if/else and loops.
This document provides an introduction to Python programming language. It discusses what Python is, its features, applications, and how it compares to compiled languages in terms of compiling versus interpreting. It also covers installing Python, different Python environments like the Python shell, IDLE, Jupyter Notebook, and Anaconda. Basic Python concepts like variables, data types, operators, functions, modules, and math module commands are explained. The reader is instructed to install NumPy and SciPy using conda for the next lab and test the installations.
This document provides an overview of Python basics training. It covers installing Python, running Python code through various methods like the command line, IDLE, and Jupyter notebooks. It also discusses Python syntax, variables, data types, operators, conditional statements, and loops. Key Python data types include integers, floats, strings, lists, and dictionaries. The document is intended as an introduction to Python for beginners.
ICT skills are abilities that help you understand and operate a wide range of technology software. This can include helping users with tasks on computers, such as making video calls, searching on the internet or using a mobile device like a tablet or phone.
The document provides an overview of the Python programming language. It discusses what Python is, its history and naming, features like being dynamically typed and interpreted, popular applications like web development, machine learning, and its architecture. It also covers Python constructs like variables, data types, operators, and strings. The document compares Python to other languages and provides examples of common Python concepts.
Feedback by akanksha bali, Feedback of FDP, Shortterm course, WorkshopAkanksha Bali
The document provides feedback from a participant on a 5-day online data science training organized by CTAE, Rajasthan from June 22-26, 2020.
The participant expresses gratitude to the organizers for the opportunity to gain valuable data science knowledge and experience through interactive sessions. All sessions were informative and experts delivered content clearly and were able to clarify doubts. Practical hands-on sessions effectively demonstrated concepts. The training improved the participant's understanding of key data science topics like regression, k-means clustering, and handling big data in MATLAB. They also learned about newer areas like CNNs, IoT with data science, and techniques for reducing stress. The participant thanks the organizers for conducting the free training during the lockdown
This document provides feedback from a research scholar about an online blockchain workshop organized by UIET, Kurukshetra University from June 15-19, 2020. The feedback praised the workshop for being knowledgeable and interesting, with clear sessions that helped gain a deep understanding of blockchain technologies. Specific sessions on blockchain fundamentals, bitcoin, private blockchains, and blockchain with IoT were highlighted as being highly informative and taught in an enjoyable, understandable manner. The resource persons were thanked for their engaging and dedicated sessions. In conclusion, the feedback expressed gratitude to the organizing team for conducting the free, knowledgeable workshop and for patiently addressing queries.
The document provides an overview of regression analysis techniques including linear regression and logistic regression. It defines regression as a statistical technique to model relationships between variables, with the goal of prediction or forecasting. Linear regression finds the best fitting straight line to model relationships between a continuous dependent variable and one or more independent variables. Logistic regression is used for classification problems where the dependent variable is categorical. The document explains the key differences between linear and logistic regression techniques.
Regression (Linear Regression and Logistic Regression) by Akanksha BaliAkanksha Bali
Regression analysis is a statistical technique used to examine relationships between variables. Linear regression finds the best fitting straight line through data points to model the relationship between a continuous dependent variable (Y) and one or more independent variables (X). Logistic regression produces results in a binary format to predict outcomes of categorical dependent variables. It transforms the linear equation using logarithms to restrict predicted Y values between 0 and 1.
Machine learning basics by akanksha baliAkanksha Bali
This document provides an introduction to machine learning, including definitions of machine learning, why it is needed, and the main types of machine learning algorithms. It describes supervised learning, unsupervised learning, semi-supervised learning, and reinforcement learning. For each type, it provides examples and brief explanations. It also discusses applications of machine learning and the differences between machine learning and deep learning.
The term Machine Learning was coined by Arthur Samuel in 1959, an american pioneer in the field of computer gaming and artificial intelligence and stated that “ it gives computers the ability to learn without being explicitly programmed” And in 1997, Tom Mitchell gave a “ well-Posed” mathematical and relational definition that “ A Computer Program is said to learn from experience E with respect to some task T and some performance measure P, if its performance on T, as measured by P, improves with experience E”.
Machine learning is needed for tasks that are too complex for humans to code directly. So instead, we provide a large amount of data to a machine learning algorithm and let the algorithm work it out by exploring that data and searching for a model that will achieve what the programmers have set it out to achieve.
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
Raish Khanji GTU 8th sem Internship Report.pdfRaishKhanji
This report details the practical experiences gained during an internship at Indo German Tool
Room, Ahmedabad. The internship provided hands-on training in various manufacturing technologies, encompassing both conventional and advanced techniques. Significant emphasis was placed on machining processes, including operation and fundamental
understanding of lathe and milling machines. Furthermore, the internship incorporated
modern welding technology, notably through the application of an Augmented Reality (AR)
simulator, offering a safe and effective environment for skill development. Exposure to
industrial automation was achieved through practical exercises in Programmable Logic Controllers (PLCs) using Siemens TIA software and direct operation of industrial robots
utilizing teach pendants. The principles and practical aspects of Computer Numerical Control
(CNC) technology were also explored. Complementing these manufacturing processes, the
internship included extensive application of SolidWorks software for design and modeling tasks. This comprehensive practical training has provided a foundational understanding of
key aspects of modern manufacturing and design, enhancing the technical proficiency and readiness for future engineering endeavors.
ELectronics Boards & Product Testing_Shiju.pdfShiju Jacob
This presentation provides a high level insight about DFT analysis and test coverage calculation, finalizing test strategy, and types of tests at different levels of the product.
Value Stream Mapping Worskshops for Intelligent Continuous SecurityMarc Hornbeek
This presentation provides detailed guidance and tools for conducting Current State and Future State Value Stream Mapping workshops for Intelligent Continuous Security.
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.
Analysis of reinforced concrete deep beam is based on simplified approximate method due to the complexity of the exact analysis. The complexity is due to a number of parameters affecting its response. To evaluate some of this parameters, finite element study of the structural behavior of the reinforced self-compacting concrete deep beam was carried out using Abaqus finite element modeling tool. The model was validated against experimental data from the literature. The parametric effects of varied concrete compressive strength, vertical web reinforcement ratio and horizontal web reinforcement ratio on the beam were tested on eight (8) different specimens under four points loads. The results of the validation work showed good agreement with the experimental studies. The parametric study revealed that the concrete compressive strength most significantly influenced the specimens’ response with the average of 41.1% and 49 % increment in the diagonal cracking and ultimate load respectively due to doubling of concrete compressive strength. Although the increase in horizontal web reinforcement ratio from 0.31 % to 0.63 % lead to average of 6.24 % increment on the diagonal cracking load, it does not influence the ultimate strength and the load-deflection response of the beams. Similar variation in vertical web reinforcement ratio leads to an average of 2.4 % and 15 % increment in cracking and ultimate load respectively with no appreciable effect on the load-deflection response.
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
π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.
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).
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.
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITYijscai
Python Basics by Akanksha Bali
1. Python
Chapter 5
Presented to
Prof. Vibhakar Mansotra
Dean of Mathematical science
Presented by
Akanksha Bali
Research Scholar, Dept of Computer science and IT
3. Python Introduction
• Python is a Programming Language. It was created by Guido van Rossum, and
released in 1991
• Used for web development, software development, Data Science, Mathematical
computing, Desktop GUI and so on.
Why Python?
• Works on different platforms ( Windows, Mac, etc).
• Has a similar syntax similar to the English Language.
• Has syntax that allows developers to write programs with fewer lines than some
other programming language.
4. Python Environment Setup
• Run the following command in the cmd.exe(command line) to check python installation for
windows.
C:Usersyour Name>python --version
• For Linux: python --version
• If python is not installed on compute, then we can download it for free from the following website:
http://www.python.org/
• To run a python file on the command line: C:Usersyour Name>python h.py
• To test a short amount of code in python command line, it is quickest and easiest not to write the
code in a file.
• C:usersYour Name>python
>>> print(“Hello, world”)
5. Python syntax
• Python programs must be written with a particular structure. The syntax
must be correct, or the interpreter will generate error message and not
execute the program.
• .py extension is used to save the file.
• We will consider two ways in which we can run
IDLE’s Interactive Shell: It is a simple python integrated development
environment available for Windows, Linux and Mac OS X. It is useful for
experimenting with small snippets of python code.
IDLE’s Editor: It has a built in editor. We can save our program using save
option in the file menu using .py extension and run the program using F5
function key or from the editors run menu:
Run -> Run Module. The output appears in the IDLE’s interactive shell
window.
6. Python Indentation
What is a code block?
• A block is a group of statements in a program or script. Usually, it consists of at least one statement
and declarations for the block, depending on the programming or scripting language.
• Programming languages usually use certain methods to group statements into blocks.
• For example in C/C++, the statements can be grouped into a code block by using the braces "{}",
#include<iostream.h>
void main()
{ cout<<"Im inside code block 1";
for(int i=0;i<=10;i++)
{
cout<<"Im inside code block 2";
for(int j=0;j<=10;j++)
{
cout<<"Im inside code block 3";
}
cout<<"Im inside code block 2";
}
cout<<"Im inside code block 1";
}
#include<iostream.h> void main(){ cout<<"Im inside code block 1";
for(int i=0;i<=10;i++){ cout<<"Im inside code block 2"; for(int
j=0;j<=10;j++){ cout<<"Im inside code block 3"; } cout<<"Im inside code
block 2"; } cout<<"Im inside code block 1"; }
7. Python Indentation (cont’d)
So what is a code block in Python?
• Python takes readability a step further by enforcing strict rules for writing code. Code
blocks in python are defined by their indentation.
• In the case of Python, it's a language requirement, not a matter of style. This principle
makes it easier to read and understand other people's Python code.
Block 1
Block 2
Block 3
Block 2
Block 1
print("This is block 1")
print("This is also block 1")
for i in range(10):
print("This is code block 2")
for j in range(10):
print("This is code block 3")
print("This is code block 2")
print("This is block 1")
8. Python Comments
• Comments can be used to explain Python code.
• Comments can be used to make the code more readable.
• Comments can be used to prevent execution when testing code.
Creating a Comment
• Comments starts with a #, and python will ignore them.
Example:
#This is a comment
Print(“hello”)
9. Python Variables
• Variables are containers for storing data values.
• Unlike other programming languages, Python has no command for declaring a variable.
• Variables do not need to be any particular type and even change type after they have been set.
• String variables can be declared either by using single or double quotes
Input Output
X=4
X=“candy”
print(x)
Candy
X=‘john’
print(x)
X=“john”
print(x)
john
john
10. Variable Names
• A variable can have a short name (like x and y) or a more descriptive name (age,
car name, total_volume).
Rules for Python variables:
• A variable name must start with a letter or the underscore character
• A variable name cannot start with a number
• A variable name can only contain alpha-numeric characters and underscores (A-z,
0-9, and _ )
• Variable names are case-sensitive (age, Age and AGE are three different variables)
11. Assign Value to Multiple Variables
• Python allows you to assign values to multiple variables in one line.
Example x, y, z=“orange”, “banana”, “cherry”
Print(x)
Print(y)
Print(z)
• Python allows you to assign same value to multiple variables in one line.
Example x= y= z=“orange”
Print(x)
Print(y)
Print(z)
Swap two variables in
python
a=5
b=6
a,b=b,a
print(a)
print(b)
#return 6
5
12. Output Variables
• To combine both text and a variable, Python uses the + Character.
Example
x= “awesome”
print(“python is” + x) #return python is awesome
• We can also use the + character to add a variable to another variable.
Example
x= “python is”
y= “awesome”
z= x + y
print(z) #return python is awesome
• For numbers, the + character works as a mathematical operator.
x= 5
y= 10
print(x + y) #return 15
Output?
x= 5
y= “john”
print(x + y)
14. Python Numbers
There are three numeric types in Python:
• int
• float
• Complex
Example:
x= 1 #int type
y= 2.5 #float type
z= 1j #complex type
Type Conversion : converting one type to another with int(), float() and complex()
methods.
16. Random Number
• Python comes with a random number generator which can be used to generate various
distributions of numbers. To access the random number generator, the random module must
be imported.
Import random
Luckynumber=random.random()
print(Luckynumber)
• If we want to generate some int value between given range then you can use
random.randrange() function. For example : suppose we want to display a random number
between 1 and 10
Import random
print(random.randrange(1,10))
19. Python Strings
• We can assign a multiline string to a variable by using three double quotes or single quotes
Example: a = “ “ “ abcderjndndmnvvmccd
nndknfkslfnskdldnndnd” ” ”
Strings are Arrays
• Python does not have a character data type, a single character is simply a string with a length of 1.
• Square brackets can be used to access elements of the string.
Example : a= “Hello, World”
print(a[1]) # returns e
print(a[2:5]) # returns llo,
print(a.strip()) # returns Hello, World
print(len(a)) # returns 12
print(a.lower()) # returns hello, world
print(a.upper()) # returns HELLO, WORLD
print(a.replace(“H”,”J”) # returns Jello, World
print(a.split(“,”)) # returns [‘Hello’, ‘World’]
0 1 2 3 4 5 6 7 8 9 10
H e l l o , W o r l d
20. String Format
• We can combine string and numbers by using format() method.
• The format() method takes the passed arguments, formats them and places them in the string
where the placeholders {} are:
Example: quantity = 10
item=20
price = 50
myorder = “ I want {} pieces of item {} for {} dollars.”
print(myorder.format(quantity, item, price))
#returns I want 10 pieces of item 20 for 50 dollars
• We can use index numbers {0} to be sure the arguments are placed in the correct placeholders.
Example: myorder= “ I want to pay{2} dollars for {0} piece of item {1}.”
# returns I want to pay 50 dollars for 10 piece of item 20
21. Python Operators
Python divides the operators in the following groups:
• Arithmetic operators
• Assignment operators
• Comparison operators
• Logical operators
• Membership operators
• Bitwise operators
22. Arithmetic Operators
• Arithmetic operators are used with numeric values to perform common mathematical operations.
Operator Name Example
+ Addition x + y
- Subtraction x - y
* Multiplication x * y
/ Division x / y
% Modulus x % y
** Exponentiation x ** y
// Floor division x // y
23. Assignment Operators
• Used to assign values to variables.
Operator Example Same as
= x = 5 x = 5
+= x += 3 x = x + 3
-= x -= 3 x = x - 3
*= x *= 3 x = x * 3
/= x /= 3 x = x / 3
%= x %= 3 x = x % 3
//= x //= 3 x = x // 3
**= x **= 3 x = x ** 3
&= x &= 3 x = x & 3
|= x |= 3 x = x | 3
^= x ^= 3 x = x ^ 3
>>= x >>= 3 x = x >> 3
<<= x <<= 3 x = x << 3
24. Comparison Operators
• Used to compare two values.
Operator Name Example
== Equal x == y
!= Not equal x != y
> Greater than x > y
< Less than x < y
>= Greater than or equal to x >= y
<= Less than or equal to x <= y
25. Logical Operators
• Used to combine conditional statements
Operator Description Example
and Returns True if both
statements are true
x < 5 and x < 10
or Returns True if one of the
statements is true
x < 5 or x < 4
not Reverse the result, returns
False if the result is true
not(x < 5 and x < 10)
26. Membership Operators
• Used to test if sequence is presented in an object.
Operator Description Example
in Returns True if a sequence
with the specified value is
present in the object
x in y
not in Returns True if a sequence
with the specified value is
not present in the object
x not in y
Input Output
X=[“apple”, “banana”]
print(“pineapple” not in x)
True
Example:
27. Bitwise Operators
• Used to compare binary numbers
Operator Name Description
& AND Sets each bit to 1 if both
bits are 1
| OR Sets each bit to 1 if one of
two bits is 1
^ XOR Sets each bit to 1 if only
one of two bits is 1
~ NOT Inverts all the bits
<< Zero fill left shift Shift left by pushing zeros
in from the right and let the
leftmost bits fall off
>> Signed right shift Shift right by pushing
copies of the leftmost bit in
from the left, and let the
rightmost bits fall off
28. Example
• >>>~12(complement of 12)
Ans -13
How?
12= 00001100 (binary format of 12)
= 11110011(1’s complement of 12)
13= 00001101(binary format of 13)
-13 = 2’s complement of 13
= 11110010( 1’s complement of 13)
= 11110011(2’s complement of 13)
• >>>12 & 13
Ans 12
12= 00001100
13=00001101
29. Import Math Functions
>>> X=sqrt(25)
Error:sqrt is not defined
>>> Import math
>>> X= math.sqrt(25)
>>>X
5.0
>>> print(math.floor(2.5))
2
>>>print(math.ceil(2.5))
3
>>>3**2
9
>>> print(math.pow(3,2))
9
>>>print(math.pi)
3.1415926.......
>>> print(math.e)
2.7182828459045
>>> import math as m
>>>x=m.sqrt(25)
>>>x
5
>>> from math import sqrt, pow
30. Python Collections (Arrays)
There are four collection data types in the Python programming language:
• List is a collection which is ordered and changeable. Allows duplicate members.
• Tuple is a collection which is ordered and unchangeable. Allows duplicate members.
• Set is a collection which is unordered and unindexed. No duplicate members.
• Dictionary is a collection which is unordered, changeable and indexed. No duplicate members.
31. Python Lists
• Python has a built in methods that we can use on lists.
Method Description
append() Adds an element at the end of the list
clear() Removes all the elements from the list
copy() Returns a copy of the list
count() Returns the number of elements with the specified value
extend() Add the elements of a list (or any iterable), to the end of the
current list
index() Returns the index of the first element with the specified value
insert() Adds an element at the specified position
pop() Removes the element at the specified position
remove() Removes the item with the specified value
reverse() Reverses the order of the list
sort() Sorts the list
32. Python Lists (Cont’d)
Examples
1. thislist = [“apple”, “banana”, “cherry”]
print(thislist) #return [‘apple’, ‘banana’, ‘cherry’]
2. print(thislist[1]) #return banana
3. thislist[1] = “guava”
print(thislist) #return [‘apple’, ‘guava’, ‘cherry’]
4. for x in thislist:
print(x) #return apple guava cherry
5. if “apple” in thislist:
print(“yes, ‘ apple’ is in fruit list”) #return yes, ‘ apple’ is in
fruit list
6. print(len(thislist)) #return 3
7. thislist.append(“orange”)
print(thislist) #return [‘apple’, ‘guava’, ‘cherry’, ‘orange’]
8. thislist.insert(1, “banana”)
print(thislist) #return [‘apple’, ‘banana’, ‘cherry’, ‘orange’]
9. thislist.remove(“banana”)
print(thislist) #return [‘apple’, ‘cherry’, ‘orange’]
10. thislist.pop()
print(thislist) #return [‘apple’, ‘cherry’]
11. del thislist[0]
print(thislist) #return [‘cherry’]
12. del thislist
print(thislist) #return thislist is not defined
13. thislist = [“apple”, “banana”, “cherry”]
thislist.clear()
print(thislist) # return []
14. thislist = [“apple”, “banana”, “cherry”]
mylist=thislist.copy()
print(mylist) #return [‘apple’, ‘banana’, ‘cherry’]
33. Python Tuples Examples
1. thistuple = (“apple”, “banana”, “cherry”)
print(thistuple) #return (‘apple’, ‘banana’,
‘cherry’)
2. print(thistuple[1]) #return banana
3. thistuple[1] = “guava”
#return error (once a tuple is created, we cannot
change its value)
4. for x in thistuple:
print(x) #return apple banana cherry
5. if “apple” in thistuple:
print(“yes, ‘ apple’ is in fruit list”) #return yes, ‘
apple’ is in fruit list
6. print(len(thistuple)) #return 3
7. thistuple.append(“orange”)
thistuple.insert(1, “banana”)
thistuple.remove(“banana”)
thistuple.pop()
del thistuple[0]
#return error (tuple is unchangeable)
8. del thistuple
# deletes the tuple
35. Python Dictionaries
• A dictionary is a collection which is unordered, changeable and indexed.
• In python dictionaries are written with curly brackets, and they have key and values.
Example: thisdict={
“brand”: “Maruti”,
“model”: “swift”,
“year”: 2005
}
print(thisdict) #return {‘brand’ : ‘Maruti’, ‘model’: ‘swift’, ‘year’:2005}
• Accessing items: by referring key name inside square brackets.
x= thisdict[“model”] # return swift
• Change Values: by referring to its key name:
thisdict[“year”]=2007
print(thisdict) #return {‘brand’ : ‘Maruti’, ‘model’: ‘swift’, ‘year’:2007}
36. Python Dictionaries (cont.)
Examples
• For x in thisdict:
print(x) #return brand model year
• For x in thisdict.values():
print(x) #return Maruti swift 2007
• If “model” in thisdict:
print(“yes”) #return yes
• print(len(thisdict)) #return 3
• thisdict[“color”]=“silver”
print(thisdict) #return {‘brand’ : ‘Maruti’, ‘model’:
‘swift’, ‘year’:2007, ‘color’: ‘silver’}
• thisdict.pop(“model”)
print(thisdict) #return {‘brand’ : ‘Maruti’, ‘year’:2007,
‘color’: ‘silver’}
• thisdict.popitem()
print(thisdict) #return {‘brand’ : ‘Maruti’, ‘year’:2007}
• del thisdict[“year”]
print(thisdict) #return {‘brand’ : ‘Maruti’}
• del thisdict
print(thisdict) #return error
• thisdict={
“brand”: “Maruti”,
“model”: “swift”,
“year”: 2005
}
mydict=thisdict.copy()
print(mydict) #return {‘brand’ : ‘Maruti’, ‘model’:
‘swift’, ‘year’:2005}
• thisdict.clear()
print(thisdict) #return {}1
38. Python if…else
• If statement is used to check a condition: if the condition is true, we run a block of
statements (called the if-block), else we process another block of statements (called the
else-block). The else clause is optional.
• a = 200
b = 33
if b > a:
print("b is greater than a")
elif a == b:
print("a and b are equal")
else:
print("a is greater than b")
# return a is greater than b
39. Python While Loops
• A while loop statement in Python programming language repeatedly executes a target statement as
long as a given condition is true.
• i = 1
while i < 6:
print(i)
if (i == 3):
break
i += 1
# return 1,2
40. Python For Loops
• A for loop is a repetition control structure.
• The main difference between for loop and while loop is that the `for` statement iterates through a
collection of iteratable object and the while statement simply loops until the condition is False.
primes = [2, 3, 5, 7]
for num in primes:
print(num)
print ("Outside the for loop")
#return 2 3 5 7
41. Python Functions
• A function is a block of code which only runs when it is called.
• In Python a function is defined using the def keyword:
• To call a function, use the function name followed by parenthesis:
• Parameters are specified after the function name, inside the parentheses. You can
add as many parameters as you want, just separate them with a comma.
• If we call the function without parameter, it uses the default value.
def my_function(country = "Norway"): #create function
print("I am from " + country)
my_function("Sweden") #calling function #return I am from Sweden
my_function() #default parameter value I am from Norway
42. Functions (contd)
def sum(a,*b):
c=a
for i in b:
c=c+i
print (c)
Sum(5,6,7,8)
Sum(5,6)
#return 26
#return 11
Passing values as references
def update(x):
print(id(x))
x=8
print(id(x))
a=10
print(id(a))
update(a)
Print(“a”,a)
#return 1795
1795
x 8
a 10
43. Python Classes/objects
• Python is an object oriented programming language.
• Almost everything in Python is an object, with its properties and
methods.
• A Class is like an object constructor, or a "blueprint" for creating
objects.
• class MyClass: #create class
x = 5 #return nothing
• Create an object named p1, and print the value of x:
• p1 = MyClass() #create object
print(p1.x) #Access the value of x #return 5
44. Python Inheritance
• Inheritance is the capability of one class to derive or inherit the properties from
some another class. The benefits of inheritance are:
• It represents real-world relationships well.
• It provides reusability of a code.
• It is transitive in nature.
• Syntax:
class BaseClass:
Body of base class
class DerivedClass(BaseClass):
Body of derived class
46. Python Inheritance
• To create a class that inherits the functionality from another class,
send the parent class as a parameter when creating the child class:
• class Student(Person):
pass
• Use the Student class to create an object, and then execute
the printname method:
• x = Student("Mike", "Olsen")
x.printname()
47. Multiple inheritance
Class A:
def feature1(self)
Print(“hello”)
Class B(A):
def feature2(self)
Print(“world”)
ClassC(B):
def feature3(self)
Print(“ good morning “)
Multiple inheritance
Class C(A,B)
48. Inheritance
Class A
Feature1
Class B
Feature2
Class C
Feature1
Feature2
Feature3
A
B
C
Multilevel Inheritance
A B
C
Multiple Inheritance
Class A
Feature1
Class B
Feature1
Feature2
Class C
Feature1
Feature2
50. Python File Handling
• File handling is an important part of any web application.
• Python has several functions for creating, reading, updating, and deleting files.
• There are four different methods (modes) for opening a file:
"r" - Read - Default value. Opens a file for reading, error if the file does not exist
"a" - Append - Opens a file for appending, creates the file if it does not exist
"w" - Write - Opens a file for writing, creates the file if it does not exist
"x" - Create - Creates the specified file, returns an error if the file exists
• In addition you can specify if the file should be handled as binary or text mode
"t" - Text - Default value. Text mode
"b" - Binary - Binary mode (e.g. images)
• Syntax: f = open("demofile.txt")
f = open("demofile.txt", "rt")
51. Python Write/Create Files
• To write to an existing file, you must add a parameter to the open() function:
• "a" - Append - will append to the end of the file
• "w" - Write - will overwrite any existing content
Example:
f = open("demofile2.txt", "a")
f.write("Now the file has more content!")
f.close()
#open and read the file after the appending:
f = open("demofile2.txt", "r")
print(f.read())
Output:
C:UsersMy Name>python
demo_file_append.py
Hello! Welcome to demofile2.txt
This file is for testing purposes.
Good Luck!Now the file has more
content!
52. Create a New File
• To create a new file in Python, use the open() method, with one of the following parameters:
"x" - Create - will create a file, returns an error if the file exist
"a" - Append - will create a file if the specified file does not exist
"w" - Write - will create a file if the specified file does not exist
Example
Create a file called "myfile.txt":
f = open("myfile.txt", "x")
Result: a new empty file is created!
Example
Create a new file if it does not exist:
f = open("myfile.txt", "w")
53. Python Delete Files
• To delete a file, you must import the OS module, and run its os.remove() function:
• Example:
import os
os.remove("demofile.txt")
• Check if file exists, then delete it:
import os
if os.path.exists("demofile.txt"):
os.remove("demofile.txt")
else:
print("The file does not exist")
• To delete an entire folder, use the os.rmdir() method:
Example: import os
os.rmdir("myfolder")
54. Python Exception Handling
• The try block lets you test a block of code for errors.
• The except block lets you handle the error.
• The finally block lets you execute code, regardless of the result of the try- and except blocks.
• When an error occurs, or exception as we call it, Python will normally stop and generate an error
message.
• These exceptions can be handled using the try statement:
• try:
print("Hello")
except:
print("Something went wrong")
else:
print("Nothing went wrong")
#return Hello
Nothing went wrong
56. The finally block, if specified, will be executed regardless if the try block raises an error or not.