The document discusses various programming concepts for an introductory programming course including data types, for loops, functions, and assignments. It covers integer and floating point numbers, strings, arithmetic operations, variable scope, and converting between data types. It also provides information on an upcoming assignment that is due in week 7 and has both written and programming components. Students are encouraged to start the assignment early and attend peer support sessions.
The document provides an introduction to the R programming language. It discusses that R is an open-source programming language for statistical analysis and graphics. It can run on Windows, Unix and MacOS. The document then covers downloading and installing R and R Studio, the R workspace, basics of R syntax like naming conventions and assignments, working with data in R including importing, exporting and creating calculated fields, using R packages and functions, and resources for R help and tutorials.
This document discusses various learning processes and techniques used in neural networks. It describes supervised learning where a network is presented inputs and target outputs to learn from, and unsupervised learning where there is no external target and the network learns from the inputs alone. Specific unsupervised techniques mentioned are Hebbian learning, competitive learning, and self-organizing maps. Supervised learning algorithms covered include least mean square and backpropagation. The document also provides examples of Hebbian learning for associative memory using hetero-associative networks.
El documento resume la historia del cine español y su recepción en Francia. Explica que películas como "Cría cuervos" de Carlos Saura y "Mujeres al borde de un ataque de nervios" de Pedro Almodóvar tuvieron éxito en Francia, al igual que otras como "Jamón jamón" y "Soledad". También resume las etapas principales de la historia del cine español, desde sus inicios hasta la actualidad. Finalmente, señala que el cine español juega un papel cada vez más importante en
Team presentation on brands exclusive australiaPriety Shrestha
1) The team presented on brandsExclusive Australia, an online retailer for fashion, cosmetics, shoes, and housewares.
2) They discussed the e-commerce, web application, and mobile application technologies used by the company. For e-commerce, they outlined the definition, impacts, organizational advantages, and challenges.
3) For mobile applications, they defined it and discussed the positive effects, challenges of implementation, and future prospects related to business, technology, society, and skills.
The document provides an introduction to the R programming language. It discusses that R is an open-source programming language for statistical analysis and graphics. It can run on Windows, Unix and MacOS. The document then covers downloading and installing R and R Studio, the R workspace, basics of R syntax like naming conventions and assignments, working with data in R including importing, exporting and creating calculated fields, using R packages and functions, and resources for R help and tutorials.
This document discusses various learning processes and techniques used in neural networks. It describes supervised learning where a network is presented inputs and target outputs to learn from, and unsupervised learning where there is no external target and the network learns from the inputs alone. Specific unsupervised techniques mentioned are Hebbian learning, competitive learning, and self-organizing maps. Supervised learning algorithms covered include least mean square and backpropagation. The document also provides examples of Hebbian learning for associative memory using hetero-associative networks.
El documento resume la historia del cine español y su recepción en Francia. Explica que películas como "Cría cuervos" de Carlos Saura y "Mujeres al borde de un ataque de nervios" de Pedro Almodóvar tuvieron éxito en Francia, al igual que otras como "Jamón jamón" y "Soledad". También resume las etapas principales de la historia del cine español, desde sus inicios hasta la actualidad. Finalmente, señala que el cine español juega un papel cada vez más importante en
Team presentation on brands exclusive australiaPriety Shrestha
1) The team presented on brandsExclusive Australia, an online retailer for fashion, cosmetics, shoes, and housewares.
2) They discussed the e-commerce, web application, and mobile application technologies used by the company. For e-commerce, they outlined the definition, impacts, organizational advantages, and challenges.
3) For mobile applications, they defined it and discussed the positive effects, challenges of implementation, and future prospects related to business, technology, society, and skills.
The document discusses stream-based data synchronization. It begins with an introduction to the topic of data synchronization and examples of use cases. It then describes how to encode changes as deltas rather than full data sets. The key aspects of stream-based synchronization are that clients receive a live stream of mutation events from the server, allowing for minimum data redundancy and bandwidth usage while enabling fast writes and distribution. An example todo list app is provided to illustrate how user actions could be translated to synchronization events that are streamed to clients.
This document discusses OLAP and MDX injection attacks. It provides an overview of OLAP and how MDX is used to query multidimensional data cubes. The document then explains how MDX injections can be used to expose sensitive data by manipulating MDX queries. Specific techniques are described, such as injecting into the WITH or SELECT clauses of an MDX query to conduct partial data retrieval or blind injections.
AWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDBAmazon Web Services
If you’re familiar with relational databases, designing your app to use a NoSQL database like DynamoDB may be new to you. In this webinar, we’ll walk you through common data design patterns for a variety of applications to help you learn how to design a schema, then store and retrieve the data with DynamoDB. We will discuss the benefits of using DynamoDB to develop mobile, web, IoT, and gaming apps.
Learning Objectives:
Learn schema design best practices with DynamoDB across multiple use cases, including gaming, AdTech, IoT, and others
Who Should Attend:
Architects, Developers, and SysOps interested in learning how to design NoSQL schemas to support mobile, web, IoT, AdTech, and gaming apps.
Familiarity with DynamoDB is helpful
Uncovering SQL Server query problems with execution plans - Tony DavisRed Gate Software
Presentation by Tony Davis at SQL in The City 2016. An execution plan tells you exactly which tables and indexes SQL Server accessed, in what order, and what other operations it performed to return the data your query needed. But sometimes, the plan for even the simplest-looking query can reveal nasty surprises.
This session describes how SQL Server generates and reuses execution plans and the implications this has for you as the developer. After a quick-start guide to retrieving and reading plans, we'll focus on techniques that can help you track down high-cost queries quickly.
We'll cover tools such as ANTS Performance Profiler, as well as scripts that hunt down execution plans for queries that caused expensive scans, sort warnings, and other issues. Examining those plans, you'll uncover the root cause of the problem, often revealing issues such as inefficient indexing, data type mismatches, and misuse of functions.
Learn more about ANTS Performance Profiler: http://www.red-gate.com/products/dotnet-development/ants-performance-profiler/
Find out about all Redgate Products: http://www.red-gate.com/products/
Connect with Tony Davis on LinkedIn: https://www.linkedin.com/in/tony-davis-208b241
MongoDB World 2018: Overnight to 60 Seconds: An IOT ETL Performance Case StudyMongoDB
The document summarizes an IOT ETL performance case study where the author collected water and electric meter data and loaded it into a database. The initial load of over 90 million documents from a 10GB file into a MongoDB database took over 4 hours. The author then redesigned the data schema, splitting it into hourly documents to improve query performance. This reduced the processing time to just 3 minutes and the data size to 13MB. The key lessons were that changing the data schema and using batch writes with multiple workers can dramatically improve ETL and query performance.
The document describes SCPatcher, a system that mines crowd security discussions to enrich secure coding practices (SCP). SCPatcher takes as input security posts from Stack Overflow and outputs SCP specifications extracted from the posts. It does this in three steps: (1) it extracts the areas containing coding examples and explanations, (2) it slices the examples and summarizes the explanations from the areas, and (3) it matches the relevant common weaknesses and vulnerabilities (CWEs) and public SCPs. The document evaluates SCPatcher on a manually labeled dataset of security posts and examines its performance on extracting coding examples and explanations as well as matching CWEs and SCPs.
Cryptography provides security through confidentiality, integrity, and availability. There are various types of security attacks including interruption, interception, and modification. Security services like authentication, confidentiality, and integrity use security mechanisms to prevent attacks. The DES algorithm encrypts data in multiple rounds using substitution boxes and permutation. It generates a cryptographic key schedule by permuting and shifting key bits. While DES had a relatively small 56-bit key, it demonstrated strong security properties like an avalanche effect.
This document contains questions and answers related to MySQL. It begins with basic questions about what MySQL is and how it differs from other databases. It then provides explanations of SQL concepts like DDL, DML, constraints, single row functions, and differences between data types. Further questions cover topics like MySQL server vs client, transactions, and examples comparing SQL commands. The remainder of the document contains a case study involving a loans database with sample tables, queries using concepts like joins, aggregation, sorting and more.
The document provides an overview of computer system organization and microprocessors. It discusses the basic structure of computer hardware, including the microprocessor, memory, and registers. It also covers memory organization and basic data types like bytes, words, and paragraphs. Additionally, it introduces several number systems including binary, decimal, octal, and hexadecimal, and how to convert between them. Finally, it discusses basics of assembly programming and using an editor and debugger.
Public Training SQL Implementation & Embedded Programming in IBM iHany Paulina
Dibuka pendaftaran Public Training SQL Implementation & Embedded Programming- in IBM i ( 23-27 Mei 2016 ). INFO TRAINING : +6281381088767/hanypaulina7@gmail.com
This document provides an overview of advanced data structures and algorithm analysis taught by Dr. Sukhamay Kundu at Louisiana State University. It discusses the role of data structures in making computations faster by supporting efficient data access and storage. The document distinguishes between algorithms, which determine the computational steps and data access order, and data structures, which enable efficient reading and writing of data. It also describes different methods for measuring algorithm performance, such as theoretical time complexity analysis and empirical measurements. Examples are provided for instrumenting code to count operations. Overall, the document introduces fundamental concepts about algorithms and data structures.
Chapter 16-spreadsheet1 questions and answerRaajTech
This document discusses spreadsheets and Excel. It defines key spreadsheet concepts like workbooks, cells, cell addresses, and formulas. It describes built-in Excel functions for date/time, arithmetic, statistical, logical, and financial calculations. The document also covers charts, macros, and databases in Excel. Spreadsheets allow users to enter, manipulate, and analyze numerical data using formulas and functions in a tabular format.
The document discusses circuit design and multiplexers. It begins by reviewing the fundamentals of circuit design, including truth tables, Boolean expressions, and simplification techniques. It then provides an example of designing a circuit to compare two 2-bit numbers. Next, it introduces multiplexers as circuits that route one of several inputs to a single output based on a selection input. It describes designing 2-to-1, 4-to-1, and larger multiplexers. It explains how multiplexers can be used to efficiently implement functions by partitioning their truth tables. In the end, it shows how multiplexers can simplify the design of an adder circuit.
This document provides an overview of deep neural network components and terminology. It begins with goals of explaining common neural network terminology and key building blocks. It then defines common terms like neurons, layers, synapses, weights, and activation. It also explains different neural network types like convolutional neural networks, recurrent neural networks, and transformers. It provides examples of 2D convolutions to illustrate filtering operations with different filter sizes, input/output maps, and strides. The document aims to establish a shared understanding of neural network concepts and components.
IRJET - Predicting the Maximum Computational Power of Microprocessors using M...IRJET Journal
This document discusses using multiple regression to predict the maximum computational power of microprocessors based on factors like number of transistors, process size, number of cores, and word size. It presents a dataset of past microprocessors and develops a multiple regression equation to estimate clock cycle (computational power) based on the other variables. The regression equation is found to predict the data accurately, especially for later values. The equation is then used to estimate computational power for hypothetical future microprocessors based on assumed values for the predictor variables.
The document discusses the topics covered in a database technologies course, including relational algebra operations. It provides examples and explanations of relational algebra concepts like selection, projection, join, union, difference, and cartesian product. It also discusses limitations of relational algebra in expressing complex queries involving transitive closure. The document contains practice questions related to relational algebra operations at the end.
This document provides an overview of digital electronics, including:
- A brief history of electronics from the invention of the light bulb to transistors.
- An explanation of analog vs. digital signals and circuits, noting that digital circuits use discrete values represented by binary numbers.
- How analog data is converted to digital data using analog-to-digital converters.
- Different number systems used in digital electronics like binary, decimal, hexadecimal and their properties.
- Examples of digital systems like computers, wireless communication, and how digital hardware is designed and implemented using programmable logic devices and application-specific integrated circuits.
UiPath Test Automation using UiPath Test Suite series, part 6DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 6. In this session, we will cover Test Automation with generative AI and Open AI.
UiPath Test Automation with generative AI and Open AI webinar offers an in-depth exploration of leveraging cutting-edge technologies for test automation within the UiPath platform. Attendees will delve into the integration of generative AI, a test automation solution, with Open AI advanced natural language processing capabilities.
Throughout the session, participants will discover how this synergy empowers testers to automate repetitive tasks, enhance testing accuracy, and expedite the software testing life cycle. Topics covered include the seamless integration process, practical use cases, and the benefits of harnessing AI-driven automation for UiPath testing initiatives. By attending this webinar, testers, and automation professionals can gain valuable insights into harnessing the power of AI to optimize their test automation workflows within the UiPath ecosystem, ultimately driving efficiency and quality in software development processes.
What will you get from this session?
1. Insights into integrating generative AI.
2. Understanding how this integration enhances test automation within the UiPath platform
3. Practical demonstrations
4. Exploration of real-world use cases illustrating the benefits of AI-driven test automation for UiPath
Topics covered:
What is generative AI
Test Automation with generative AI and Open AI.
UiPath integration with generative AI
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
The document discusses stream-based data synchronization. It begins with an introduction to the topic of data synchronization and examples of use cases. It then describes how to encode changes as deltas rather than full data sets. The key aspects of stream-based synchronization are that clients receive a live stream of mutation events from the server, allowing for minimum data redundancy and bandwidth usage while enabling fast writes and distribution. An example todo list app is provided to illustrate how user actions could be translated to synchronization events that are streamed to clients.
This document discusses OLAP and MDX injection attacks. It provides an overview of OLAP and how MDX is used to query multidimensional data cubes. The document then explains how MDX injections can be used to expose sensitive data by manipulating MDX queries. Specific techniques are described, such as injecting into the WITH or SELECT clauses of an MDX query to conduct partial data retrieval or blind injections.
AWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDBAmazon Web Services
If you’re familiar with relational databases, designing your app to use a NoSQL database like DynamoDB may be new to you. In this webinar, we’ll walk you through common data design patterns for a variety of applications to help you learn how to design a schema, then store and retrieve the data with DynamoDB. We will discuss the benefits of using DynamoDB to develop mobile, web, IoT, and gaming apps.
Learning Objectives:
Learn schema design best practices with DynamoDB across multiple use cases, including gaming, AdTech, IoT, and others
Who Should Attend:
Architects, Developers, and SysOps interested in learning how to design NoSQL schemas to support mobile, web, IoT, AdTech, and gaming apps.
Familiarity with DynamoDB is helpful
Uncovering SQL Server query problems with execution plans - Tony DavisRed Gate Software
Presentation by Tony Davis at SQL in The City 2016. An execution plan tells you exactly which tables and indexes SQL Server accessed, in what order, and what other operations it performed to return the data your query needed. But sometimes, the plan for even the simplest-looking query can reveal nasty surprises.
This session describes how SQL Server generates and reuses execution plans and the implications this has for you as the developer. After a quick-start guide to retrieving and reading plans, we'll focus on techniques that can help you track down high-cost queries quickly.
We'll cover tools such as ANTS Performance Profiler, as well as scripts that hunt down execution plans for queries that caused expensive scans, sort warnings, and other issues. Examining those plans, you'll uncover the root cause of the problem, often revealing issues such as inefficient indexing, data type mismatches, and misuse of functions.
Learn more about ANTS Performance Profiler: http://www.red-gate.com/products/dotnet-development/ants-performance-profiler/
Find out about all Redgate Products: http://www.red-gate.com/products/
Connect with Tony Davis on LinkedIn: https://www.linkedin.com/in/tony-davis-208b241
MongoDB World 2018: Overnight to 60 Seconds: An IOT ETL Performance Case StudyMongoDB
The document summarizes an IOT ETL performance case study where the author collected water and electric meter data and loaded it into a database. The initial load of over 90 million documents from a 10GB file into a MongoDB database took over 4 hours. The author then redesigned the data schema, splitting it into hourly documents to improve query performance. This reduced the processing time to just 3 minutes and the data size to 13MB. The key lessons were that changing the data schema and using batch writes with multiple workers can dramatically improve ETL and query performance.
The document describes SCPatcher, a system that mines crowd security discussions to enrich secure coding practices (SCP). SCPatcher takes as input security posts from Stack Overflow and outputs SCP specifications extracted from the posts. It does this in three steps: (1) it extracts the areas containing coding examples and explanations, (2) it slices the examples and summarizes the explanations from the areas, and (3) it matches the relevant common weaknesses and vulnerabilities (CWEs) and public SCPs. The document evaluates SCPatcher on a manually labeled dataset of security posts and examines its performance on extracting coding examples and explanations as well as matching CWEs and SCPs.
Cryptography provides security through confidentiality, integrity, and availability. There are various types of security attacks including interruption, interception, and modification. Security services like authentication, confidentiality, and integrity use security mechanisms to prevent attacks. The DES algorithm encrypts data in multiple rounds using substitution boxes and permutation. It generates a cryptographic key schedule by permuting and shifting key bits. While DES had a relatively small 56-bit key, it demonstrated strong security properties like an avalanche effect.
This document contains questions and answers related to MySQL. It begins with basic questions about what MySQL is and how it differs from other databases. It then provides explanations of SQL concepts like DDL, DML, constraints, single row functions, and differences between data types. Further questions cover topics like MySQL server vs client, transactions, and examples comparing SQL commands. The remainder of the document contains a case study involving a loans database with sample tables, queries using concepts like joins, aggregation, sorting and more.
The document provides an overview of computer system organization and microprocessors. It discusses the basic structure of computer hardware, including the microprocessor, memory, and registers. It also covers memory organization and basic data types like bytes, words, and paragraphs. Additionally, it introduces several number systems including binary, decimal, octal, and hexadecimal, and how to convert between them. Finally, it discusses basics of assembly programming and using an editor and debugger.
Public Training SQL Implementation & Embedded Programming in IBM iHany Paulina
Dibuka pendaftaran Public Training SQL Implementation & Embedded Programming- in IBM i ( 23-27 Mei 2016 ). INFO TRAINING : +6281381088767/hanypaulina7@gmail.com
This document provides an overview of advanced data structures and algorithm analysis taught by Dr. Sukhamay Kundu at Louisiana State University. It discusses the role of data structures in making computations faster by supporting efficient data access and storage. The document distinguishes between algorithms, which determine the computational steps and data access order, and data structures, which enable efficient reading and writing of data. It also describes different methods for measuring algorithm performance, such as theoretical time complexity analysis and empirical measurements. Examples are provided for instrumenting code to count operations. Overall, the document introduces fundamental concepts about algorithms and data structures.
Chapter 16-spreadsheet1 questions and answerRaajTech
This document discusses spreadsheets and Excel. It defines key spreadsheet concepts like workbooks, cells, cell addresses, and formulas. It describes built-in Excel functions for date/time, arithmetic, statistical, logical, and financial calculations. The document also covers charts, macros, and databases in Excel. Spreadsheets allow users to enter, manipulate, and analyze numerical data using formulas and functions in a tabular format.
The document discusses circuit design and multiplexers. It begins by reviewing the fundamentals of circuit design, including truth tables, Boolean expressions, and simplification techniques. It then provides an example of designing a circuit to compare two 2-bit numbers. Next, it introduces multiplexers as circuits that route one of several inputs to a single output based on a selection input. It describes designing 2-to-1, 4-to-1, and larger multiplexers. It explains how multiplexers can be used to efficiently implement functions by partitioning their truth tables. In the end, it shows how multiplexers can simplify the design of an adder circuit.
This document provides an overview of deep neural network components and terminology. It begins with goals of explaining common neural network terminology and key building blocks. It then defines common terms like neurons, layers, synapses, weights, and activation. It also explains different neural network types like convolutional neural networks, recurrent neural networks, and transformers. It provides examples of 2D convolutions to illustrate filtering operations with different filter sizes, input/output maps, and strides. The document aims to establish a shared understanding of neural network concepts and components.
IRJET - Predicting the Maximum Computational Power of Microprocessors using M...IRJET Journal
This document discusses using multiple regression to predict the maximum computational power of microprocessors based on factors like number of transistors, process size, number of cores, and word size. It presents a dataset of past microprocessors and develops a multiple regression equation to estimate clock cycle (computational power) based on the other variables. The regression equation is found to predict the data accurately, especially for later values. The equation is then used to estimate computational power for hypothetical future microprocessors based on assumed values for the predictor variables.
The document discusses the topics covered in a database technologies course, including relational algebra operations. It provides examples and explanations of relational algebra concepts like selection, projection, join, union, difference, and cartesian product. It also discusses limitations of relational algebra in expressing complex queries involving transitive closure. The document contains practice questions related to relational algebra operations at the end.
This document provides an overview of digital electronics, including:
- A brief history of electronics from the invention of the light bulb to transistors.
- An explanation of analog vs. digital signals and circuits, noting that digital circuits use discrete values represented by binary numbers.
- How analog data is converted to digital data using analog-to-digital converters.
- Different number systems used in digital electronics like binary, decimal, hexadecimal and their properties.
- Examples of digital systems like computers, wireless communication, and how digital hardware is designed and implemented using programmable logic devices and application-specific integrated circuits.
UiPath Test Automation using UiPath Test Suite series, part 6DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 6. In this session, we will cover Test Automation with generative AI and Open AI.
UiPath Test Automation with generative AI and Open AI webinar offers an in-depth exploration of leveraging cutting-edge technologies for test automation within the UiPath platform. Attendees will delve into the integration of generative AI, a test automation solution, with Open AI advanced natural language processing capabilities.
Throughout the session, participants will discover how this synergy empowers testers to automate repetitive tasks, enhance testing accuracy, and expedite the software testing life cycle. Topics covered include the seamless integration process, practical use cases, and the benefits of harnessing AI-driven automation for UiPath testing initiatives. By attending this webinar, testers, and automation professionals can gain valuable insights into harnessing the power of AI to optimize their test automation workflows within the UiPath ecosystem, ultimately driving efficiency and quality in software development processes.
What will you get from this session?
1. Insights into integrating generative AI.
2. Understanding how this integration enhances test automation within the UiPath platform
3. Practical demonstrations
4. Exploration of real-world use cases illustrating the benefits of AI-driven test automation for UiPath
Topics covered:
What is generative AI
Test Automation with generative AI and Open AI.
UiPath integration with generative AI
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
Programming Foundation Models with DSPy - Meetup SlidesZilliz
Prompting language models is hard, while programming language models is easy. In this talk, I will discuss the state-of-the-art framework DSPy for programming foundation models with its powerful optimizers and runtime constraint system.
Removing Uninteresting Bytes in Software FuzzingAftab Hussain
Imagine a world where software fuzzing, the process of mutating bytes in test seeds to uncover hidden and erroneous program behaviors, becomes faster and more effective. A lot depends on the initial seeds, which can significantly dictate the trajectory of a fuzzing campaign, particularly in terms of how long it takes to uncover interesting behaviour in your code. We introduce DIAR, a technique designed to speedup fuzzing campaigns by pinpointing and eliminating those uninteresting bytes in the seeds. Picture this: instead of wasting valuable resources on meaningless mutations in large, bloated seeds, DIAR removes the unnecessary bytes, streamlining the entire process.
In this work, we equipped AFL, a popular fuzzer, with DIAR and examined two critical Linux libraries -- Libxml's xmllint, a tool for parsing xml documents, and Binutil's readelf, an essential debugging and security analysis command-line tool used to display detailed information about ELF (Executable and Linkable Format). Our preliminary results show that AFL+DIAR does not only discover new paths more quickly but also achieves higher coverage overall. This work thus showcases how starting with lean and optimized seeds can lead to faster, more comprehensive fuzzing campaigns -- and DIAR helps you find such seeds.
- These are slides of the talk given at IEEE International Conference on Software Testing Verification and Validation Workshop, ICSTW 2022.
For the full video of this presentation, please visit: https://www.edge-ai-vision.com/2024/06/building-and-scaling-ai-applications-with-the-nx-ai-manager-a-presentation-from-network-optix/
Robin van Emden, Senior Director of Data Science at Network Optix, presents the “Building and Scaling AI Applications with the Nx AI Manager,” tutorial at the May 2024 Embedded Vision Summit.
In this presentation, van Emden covers the basics of scaling edge AI solutions using the Nx tool kit. He emphasizes the process of developing AI models and deploying them globally. He also showcases the conversion of AI models and the creation of effective edge AI pipelines, with a focus on pre-processing, model conversion, selecting the appropriate inference engine for the target hardware and post-processing.
van Emden shows how Nx can simplify the developer’s life and facilitate a rapid transition from concept to production-ready applications.He provides valuable insights into developing scalable and efficient edge AI solutions, with a strong focus on practical implementation.
Ivanti’s Patch Tuesday breakdown goes beyond patching your applications and brings you the intelligence and guidance needed to prioritize where to focus your attention first. Catch early analysis on our Ivanti blog, then join industry expert Chris Goettl for the Patch Tuesday Webinar Event. There we’ll do a deep dive into each of the bulletins and give guidance on the risks associated with the newly-identified vulnerabilities.
Unlocking Productivity: Leveraging the Potential of Copilot in Microsoft 365, a presentation by Christoforos Vlachos, Senior Solutions Manager – Modern Workplace, Uni Systems
How to Get CNIC Information System with Paksim Ga.pptxdanishmna97
Pakdata Cf is a groundbreaking system designed to streamline and facilitate access to CNIC information. This innovative platform leverages advanced technology to provide users with efficient and secure access to their CNIC details.
Fueling AI with Great Data with Airbyte WebinarZilliz
This talk will focus on how to collect data from a variety of sources, leveraging this data for RAG and other GenAI use cases, and finally charting your course to productionalization.
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfMalak Abu Hammad
Discover how MongoDB Atlas and vector search technology can revolutionize your application's search capabilities. This comprehensive presentation covers:
* What is Vector Search?
* Importance and benefits of vector search
* Practical use cases across various industries
* Step-by-step implementation guide
* Live demos with code snippets
* Enhancing LLM capabilities with vector search
* Best practices and optimization strategies
Perfect for developers, AI enthusiasts, and tech leaders. Learn how to leverage MongoDB Atlas to deliver highly relevant, context-aware search results, transforming your data retrieval process. Stay ahead in tech innovation and maximize the potential of your applications.
#MongoDB #VectorSearch #AI #SemanticSearch #TechInnovation #DataScience #LLM #MachineLearning #SearchTechnology
Full-RAG: A modern architecture for hyper-personalizationZilliz
Mike Del Balso, CEO & Co-Founder at Tecton, presents "Full RAG," a novel approach to AI recommendation systems, aiming to push beyond the limitations of traditional models through a deep integration of contextual insights and real-time data, leveraging the Retrieval-Augmented Generation architecture. This talk will outline Full RAG's potential to significantly enhance personalization, address engineering challenges such as data management and model training, and introduce data enrichment with reranking as a key solution. Attendees will gain crucial insights into the importance of hyperpersonalization in AI, the capabilities of Full RAG for advanced personalization, and strategies for managing complex data integrations for deploying cutting-edge AI solutions.
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdfTechgropse Pvt.Ltd.
In this blog post, we'll delve into the intersection of AI and app development in Saudi Arabia, focusing on the food delivery sector. We'll explore how AI is revolutionizing the way Saudi consumers order food, how restaurants manage their operations, and how delivery partners navigate the bustling streets of cities like Riyadh, Jeddah, and Dammam. Through real-world case studies, we'll showcase how leading Saudi food delivery apps are leveraging AI to redefine convenience, personalization, and efficiency.
Have you ever been confused by the myriad of choices offered by AWS for hosting a website or an API?
Lambda, Elastic Beanstalk, Lightsail, Amplify, S3 (and more!) can each host websites + APIs. But which one should we choose?
Which one is cheapest? Which one is fastest? Which one will scale to meet our needs?
Join me in this session as we dive into each AWS hosting service to determine which one is best for your scenario and explain why!
GraphRAG for Life Science to increase LLM accuracyTomaz Bratanic
GraphRAG for life science domain, where you retriever information from biomedical knowledge graphs using LLMs to increase the accuracy and performance of generated answers
GraphRAG for Life Science to increase LLM accuracy
Assmnt 1
1. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)
ITECH1000/5000 Programming 1
Lecture 2: Some new concepts :
Data types, For Loops and
Functions
2. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)
Assignment 1
May 28, 20132
Available on Moodle
Due in week 7, Friday April 27th
2012
Start early – written component and programming
component to complete
3. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)
PASS
Sessions with peers
Start next week, airport lounge
Times on moodle
May 28, 20133
4. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)
Extension work
Assignment
Download sample programs from text
(moodle), run the file roller.py
Read text book - graphics
Watch moodle for times for extension
discussion group
(9.30am Friday morning?)
May 28, 20134
5. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 20135
Last Week We Covered . . .
• Programs provide instructions for
computers
• Follow a strict syntax
• All (or most) programs
• Receive input (eg from keyboard)
• Process that data
• Provide output
6. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 20136
Last Week We Covered . . .
• Data is stored in variables
• Variables enable access to values on the activation stack
• The use of variables depends upon where they appear in
the statement.
• Variables have their values set if they appear on the left
side of an assignment statement
• The values of variables are retrieved if they appear on the
right side of an assignment statement or in a print
statement
7. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 20137
Last week: Activation stack
• We have said that a computer stores
values in its memory using variables.
• The program uses a structure that looks
like a stack (we call it the activation stack)
• When the program encounters a new
variable it makes space for its value on
top of the stack.
8. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)
Last week: Expressions
• Made up of operators performing
operations on operands
• Evaluate to a value
• Used on right hand side of
assignment statements (and other
places)
May 28, 20138
9. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)
Last week: Statements
• Instructions are encoded in
statements
• 3 types of statements:
• Assignment statements
• Input statements
• Output (print) statements
May 28, 20139
10. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201310
Last week: Assignment
statement
• Made up of three parts
• A variable on the left side of ‘=‘
• The operator ‘=‘
• An expression on the right side of ‘=‘
• If a variable appears on the right side of
‘=‘ its value is retrieved and used
• num1 = num1 + 3
• Answer is stored in assigned variable
11. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201311
Last Week We Covered . . .
• We saw how we could use Python
Shell interactively
• However, for programs that we use a
lot it’s best to make a permanent
record
• Make sure you save files with a .py
suffix
12. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)
Question
• What is the ‘^’ operator?
• It’s the bitwise exclusive or. It
manipulates values at the level of
bits (0’s and 1’s)
• Way beyond the scope of this course
May 28, 201312
13. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201313
Last week: Main function
• All of our Python programs should start with a function
(yep – more on functions later) called ‘main’
• We define this function with the line
‘def main ( ):’ #don’t forget the ‘:’
• The instructions that belong to main are indented (one tab)
• The line ‘main ( )’ tells the program to execute the
instructions belonging to main
• This will all make a lot more sense when we discuss
functions in detail
14. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201314
Program Execution
• Now that we’ve written the instructions we need
to get the computer to perform the actions
• This is called running or executing the program
• The code is executed, one statement at a time,
starting with the statement at the top of the main
function
• When the program has completed the actions
from one statement, it moves onto the next.
15. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201315
Activation stack
num1 6.4
main()
num1 = input (“Enter the first number “)
num2 = input (“Enter the second number “)
result = num1 + num2
print result
Assume the user enters 6.4 and 3.6
16. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201316
Activation Stack
num2 3.6
num1 6.4
main ()
num1 = input (“Enter the first number “)
num2 = input (“Enter the second number “)
result = num1 + num2
print result
Assume the user enters 6.4 and 3.6
17. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201317
Activation Stack
result 10.0
num2 3.6
num1 6.4
main ()
num1 = input (“Enter the first number “)
num2 = input (“Enter the second number “)
result = num1 + num2
print result
Assume the user enters 6.4 and 3.6
18. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201318
Activation stack
result 10.0
num2 3.6
num1 6.4
main ()
num1 = input (“Enter the first number “)
num2 = input (“Enter the second number “)
result = num1 + num2
print result
Assume the user enters 6.4 and 3.6
19. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201319
Today
• Data types
• A looping construct
• called the for loop
• Some built-in functions
• A function is code already written that we can
use to perform an action
• Saves us writing the code ourselves
20. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201320
Data types
• A data type reflect the sorts of data
we are currently working with
• A data type determine the range of
data and the operations that can be
performed on that data
21. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201321
Types of data
• Fundamental data types include:
• Integers (whole numbers) e.g. 5
• Floats (decimal numbers) e.g. 3.8
• Strings (of characters) using quotes
• Many programming languages use
single quotes for a single character
and double quotes for larger strings
• E.g. ‘J’ and “John”
22. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201322
For example
• 3 is an integer and so is 5.
• Knowing this, the program will allow us to do
arithmetic operations on them
• eg ‘+’, ‘-’, ‘*’
• That’s pretty straightforward when considering literals
like 3 and 5
• It becomes a little trickier when working with
variables which can have different types and different
stages of program execution
23. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201323
Strings
• Our third data type is called a string
• A string is textual – not numeric
• It consists of a group of characters contained in
quotes (either single or double)
• Example
• “John”, ‘John’, ‘3’, “4”, “Please enter a number:”
24. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201324
Identifiers, Strings, Literals
• Strings are surrounded by single or double
quotes (Python does not distinguish)
• Identifiers (variable names) are not
surrounded by quotes
• Literals are specific values such as “John”,
5, 3.8 (compare with variables)
25. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201325
Input with Strings
• name = input(“Enter your name: “)
• If “John” is entered that is fine
• If the quotes are forgotten then Python interprets
the response as an identifier or variable name
that is undefined – an error!
• An alternative is to use raw_input
26. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201326
raw_input( )
name = raw_input(“Enter your name: “)
• Any input is treated as a string
• Entering John or any other string without quotes is no
longer a problem
• However if raw_input() is used to enter a number:
• The number will be of type string
• Arithmetic is not possible without conversion using float()
27. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201327
Concatenation
• Refers to the combining of two or more strings
• E.g. name = “John” + ‘ ‘ + “Smith”
• The string expression on the right hand side is
evaluated (concatenated) and assigned to name
• ‘+’ here is the concatenation operator
28. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201328
Note
• We can only concatenate strings
• We cannot concatenate a string with an integer.
For example
“Jane: Age “ + 35
• Will give an error message
• Trivial question – what will happen if we try to
concatenate two integers?
29. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201329
Joining/Splitting strings
• String Concatenation operator ‘+’
“John” + ‘ ‘ + “Smith” John Smith
• A library function which is the inverse of
concatenation
string.split(“John Smith”) [“John”, “Smith”]
The string has been separated at the space and
a list of two strings results
30. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201330
String of characters
• “John Smith” is stored as a list of
characters each of which can be accessed
by its index
index 0 1 2 3 4 5 6 7 8 9
Character ‘J’ ‘o’ ‘h’ ‘n’ ‘ ’ ‘S’ ‘m’ ‘i’ ‘t’ ‘h’
• E.g. “John Smith”[0] ‘J’
• “John Smith”[8] ‘t’
31. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201331
Substrings
• “John Smith”[0:3] “Joh”
• The second index is NOT included
•
• “John Smith”[:3] “Joh”
• If the first index is 0 it can be left out
• “John Smith”[2:6] “hn S”
• Indexes 2,3,4,5 (6-2=4 characters)
32. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201332
Substrings
• “John Smith”[-1] ‘h’
• Negative sign means start from the end
(-0 is the same as 0)
• “John Smith”[:-1] ‘John Smit’
• Select up to but excluding the last
character
34. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201334
Converting type
Note that:
• float() adds .0 to an integer
• float() removes the quotes from a numerical
string
• int() cuts off any decimal part of the number
• round() expresses the number to the nearest
integer
35. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201335
Mixed arithmetic
• Any valid numerical expression that
contains at least one float will evaluate as
a float
• Otherwise the result will be of type integer
• It is not possible to do arithmetic with
numeric strings such as “2” + 7
36. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201336
Integer division
• We spent a bit of time last week looking at code using
integers and floats
• One surprise with integers might be integer division
num1 = 11
num2 = 4
result = num1 / num2
• Because num1 and num2 are both integers the result
of the division is also an integer
• Thus result will have the value 2 – not 2.75
37. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201337
Integer division - modulus
• 11 divided by 4 can be expressed
2 remainder 3
• Integer division gives us the whole number (2)
• The modulus operator ‘%’ gives us the remainder (3).
result = 11 % 4
• Will put the value 3 into the variable result
• The modulus operator cannot be used with floats
38. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201338
Floating point division
• A floating point number has a decimal part as well as
a whole number
• Eg 11.4, 454.83737 etc
• The decimal part might be 0. So
• 11 has data type int
• 11.0 has data type float
• If a division has at least one float then the result will
be a float
• result = 11.0 / 4
• Puts the value 2.75 into the variable result
39. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201339
Using our type conversions
• Consider the code
num1 = 11
num2 = 4
result = num1 / num2 #Result assigned ‘2’
• If we want 2.75 we can give one of the variables data
type float
result = float (num1) / num2 #or
result = num1 / float (num2)
40. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201340
Concatenation
• Refers to the combining of two or more strings
• E.g. name = “John” + ‘ ‘ + “Smith”
• The string expression on the right hand side is
evaluated (concatenated) and assigned to name
• ‘+’ here is the concatenation operator
41. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201341
Note
• We can only concatenate strings
• We cannot concatenate a string with an integer.
For example
“Jane: Age “ + 35
• Will give an error message
• Trivial question – what will happen if we try to
concatenate two integers?
42. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201342
Consider . . .
• A program that
• Prompts the user for a person’s name
• Creates a string greets that person
• Outputs that string
• Does this four times
• For example, if the user enters
“Jane” then “Hello Jane!” should be
output
43. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201343
Demo – sayHello.py
• Note that with this program we repeat the same
code four times
• What if we wanted to repeat it 10 times, 100
times . . .?
• This would become cumbersome very quickly
• Python provides constructs which enable us to
run the same code many times
45. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)
#Prompts for a person's name and says greets that person
#Does this four times
def main():
name = input ("Enter a name: ") #prompt for name
result = "Hello " + name + "!" #prepare greeting
print result #output greeting
name = input ("Enter a name: ") #Do it again
result = "Hello " + name + "!"
print result
name = input ("Enter a name: ") #And again
result = "Hello " + name + "!"
print result
name = input ("Enter a name: ") #And a fourth time
result = "Hello " + name + "!"
print result
main()
#Notice how similar the four pieces of code are
#Wouldn't it be better if we could simply use the same piece of code 4 times
#Python provides looping structures which allow us to do this
May 28, 2013
46. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201346
Definite loops
• One of the great values of the computer is
that it can repeat actions indefinitely
(without tiring)
• The programming structure that allows
this is the loop
• A definite loop (called a for loop) repeats
loop code a fixed number of times
47. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201347
range
• The number of times the for loop
‘iterates’ is governed by the ‘range’
function
• ‘range(4)’ means 0,1,2,3, so that the
for loop iterates 4 times.
48. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)
#uses a for loop to repeat greetings four times
def main():
for index in range(4): #do 4 times
name = input ("Enter a name: ")
# name = raw_input ("Enter a name: ")
greeting = "Hello " + name + "!"
print "Person number ", index
print greeting
main()
#The 'for loop' iterates 4 times
#The statements which are part of the loop are defined by the indenting
#Try taking the indenting away and see what happens
#We will also have a look at the variable 'index' to see what values it
contains
May 28, 201348
49. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201349
range
• range(4) takes the values 0, 1, 2, 3
so index is assigned these values in
turn
• adding index to the print statement
shows this
50. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201350
Some more looping examples
(see sum10.py)
• Consider a program that will sum all
of the integers between 1 and 10
• Extend this so that it prompts the
user for a start and finish number. It
then sums the integers between
these values.
• if the use enters 3 and 10 the output
will be 52
51. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)
Sum10.py
# program to find the total of the integers between 1 and 10
def main():
total = 0
for index in range(10):
total = total + index + 1 # add the number to the total
print "Total: ", total # display the total
main()
May 28, 201351
52. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)
Algorithm
Need range to start from num1 not
zero HOW?
Range to go up to num2
Loop
add val to total
Print total
May 28, 201352
53. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)
Algorithm design (not worrying
about syntax)
Need range to start from num1 not
zero HOW?
Range to go up to num2
Input num1 and num2
Initialise total =0 WHY?
Loop from num1 to num2
add val to total
Print total
May 28, 201353
54. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)
range function
Need to find out if I can start at
something other than zero… how?
Range is a function that has been
previously written as part of the
python library.
Google it: “python range function”
May 28, 201354
58. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201358
Consider
(see sumNumbers.py)
• A program that sums 4 numbers that
are entered by the user.
59. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201359
# program to find the total of all numbers entered by the user
# will cause an error because runningTotal not initialised before use
def main():
# input how many numbers will be entered (numberOfValues)
numberOfValues = input("How many numbers will be entered? ")
for index in range(numberOfValues): # repeat ‘numberOfValues’ times
num = input("Enter a number: ")
runningTotal = runningTotal + num # add the number to the total
# error at this line
print runningTotal,
print "Total: ", runningTotal # display the total
main()
60. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201360
Note
• The character “t” is a control
character which prints out a tab
• A control character is preceded by ‘’
so be careful when using the
backslash in a string
• Another control character is ‘n’
which means new line
61. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201361
Note (2)
• Notice that the print statement in the
inner loop finishes with a comma (,)
• This will tell the program not to print
a new line
• The next output will occur on the same
line
62. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201362
Python standard library
• Can access the library from the Help menu in
either the shell or the editor
• Provides functions additional to the built-in ones
• Has a math section and a string section
• Library functions are accessed via import
statements
63. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201363
Some library functions
>>> import math
>>> math.sqrt(36) displays 6
>>> import string
>>> string.lower(“UPPERCASE”)
>>> string.upper(“lowercase”)
64. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201364
Import statements
• These establish a link with the Python Standard
library
• Any particular import statement is only required
once:
• in any given program
• in an open Python shell
• A new Python shell requires new import
statements if library functions are required
65. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)
Built–in functions
• A function is a small package of
Python code that performs a certain
task (function)
• Functions can be user-defined
• Coded by the programmer (see week 4)
• Functions can be built-in or library
• Written by someone else for our use
May 28, 201365
66. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)
Built-in functions
• We have already seen some
examples of a built-in function
• We have used the input function to
retrieve user input from the keyboard
• We used the range function in a for loop
• We will see more examples of built-in
functions today
May 28, 201366
67. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201367
Functions
• When we start writing programs to solve more
complicated problems, we’ll find that we need to
write large amounts of code
• Some programs have millions of lines of code
• Putting all of this code into the main function
would make it impossible to work with
• Functions are a way to split code up into pieces
that can be dealt with individually
68. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201368
Functions
• Can be built-in
• Examples are float (), input () etc
• Included in an external library
• string and math libraries for example
• Can be user-defined
• The programmer writes them
• We will be covering built-in functions today
69. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201369
Advantages of Functions
• Code can be written, tested and debugged
in smaller pieces
• Allows a divide and conquer strategy for
dealing with your code
• Functions can be reused in different
situations meaning you don’t have to
rewrite code
• input ( ) – is a built-in function - think about
how many times we’ve already used and
reused that function
70. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201370
Splitting strings
• An library function which is the inverse of
concatenation
“John” + ‘ ‘ + “Smith” John Smith
string.split(“John Smith”) [“John”, “Smith”]
• The string has been separated at the space and a
list of two strings results
71. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201371
The typical function
• Functions consist of code that carries out a
specific task (or ‘function’)
• Many will require arguments
• Many will return (output) data as the
prime reason for their existence, others
will produce what are sometimes called
side effects
• Eg input function
72. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201372
Familiar functions
• Built-in functions
• float(7) 7.0
• float(“7.8”) 7.8
• int(7.8) 7
• round(7.8) 8.0
• len(“a string”) 8
• Argument types are int, str, float, float
and str respectively
• Return types for these functions are
• float – two occasions
• int – three occasions
73. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201373
Familiar functions
• Library functions
• math.sqrt(144) 12.0
• string.split(“the end”) [“the”, ”end”]
• math.sqrt() - the argument can be of type int or
float, a float is returned
• string.split() – the argument is a string and a list
of strings is returned
• Remember these libraries need to be imported
74. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201374
# sqrtExample.py
# a program to demonstrate the library function 'sqrt'
import math # library that holds the function 'sqrt'
def main ( ):
num = input ("Please enter a number: ")
numRoot = math.sqrt (num); # Use the library name
followed by '.'
print "The root of ", num, " is ", numRoot
main ( )
Argument (input)
to the function
math.sqrt()
75. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201375
Arguments
(see sqrtExample.py)
• In the example on the previous slide,
‘num’ is an argument of the function
‘sqrt’
• An argument is an expression which
must be evaluated.
• Eg. math.sqrt (num * 2)
76. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201376
Using functions
• When a function is used with a program, e.g.
math.sqrt(), we say the function is called
• The function from which the call is made (in this
case main ( )) is the calling function
• The argument of the function call becomes
essential input for the function
• When a function is called, control of execution
passes to the function
77. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201377
Using functions
• When a function has completed its
processing (terminates), control
returns to the calling function
• the calling function can make use of
the value returned by the called
function
78. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201378
Reuse of Code
• The functions that have been referred to
(and many others) are used time and time
again
• This is a significant example of reuse of
code, saving countless hours of work
• Modifying existing programs for slightly
different purposes is another important
example of reuse of code (see labs)
79. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201379
The black box
• Note that when we use these built-in
and library functions, we do not need
to know how they work
• We only need to know how to use them
• We only need to know the inputs and
outputs. The processing is already
done.
80. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)
Functions
• Often require arguments
• Expressions or values which provide
input for the function
• Normally provide a return value
• A value, calculated by the function, that
we can use in our code
May 28, 201380
81. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)
Example
num = input (“Enter a number”)
“Enter a number” is an argument
The value entered at the keyboard by the
user becomes the return value of the
function
The return value is used in the assignment
expression
May 28, 201381
82. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)
Today we have covered
May 28, 201382
• Data Types – strings, integers, floats
• For loops
• Functions
83. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)
Review
May 28, 201383
• Data types – strings, integers, floats
• Input() if you enter a string need to
enclose in “ “
• raw_input() no need for “ “
• Functions take arguments as input
84. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201384
Review
• Integer division gives an integer result (ignoring
the remainder)
• Operator % gives the remainder
• Built-in functions include: type(), float(), int(),
round(), str(), len()
• Library functions extend the range of functions
substantially – they require one-off import
statements
85. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201385
Definite loops
•A definite loop (called a for loop) repeats
loop code a fixed number of times
for index in range(x)
stmt
stmt
86. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)
Review
May 28, 201386
• Functions enable us to design good programs and to re-use code
• Functions take input through arguments and return a result to the
calling code (usually)
def main() : #define the function main
stmt
stmt
main() # call the function main
87. CRICOS Provider Number 00103D(Vic) 01266K (NSW) 02235J (SA)May 28, 201387
Remember
• Giving full attention to labs is essential –
practice, experiment and have fun!
• Ensure you have each lab completed
before the next one
• The theory test in week 5 is based on
experience gained from the first four labs
(and lectures)