This document provides an introduction to Python basics including data types, operations, variables, user input/output, strings, numbers, and type conversion. It discusses integers, floats, booleans, arithmetic operators, comparison operators, and functions like int(), float(), str(), type(), print(), and raw_input(). The document contains examples of code snippets and exercises for readers to practice Python concepts.
This document summarizes an event being organized by the Department of Computer Science Engineering and Department of Electronics and Instrumentation Engineering at Kamaraj College of Engineering and Technology. The event is called "TECHSHOW '19" and is aimed at +2 school students. It will take place on November 30th, 2019 and will include notes on Python programming, including topics like sequence containers, indexing, base types, and functions.
Python легко и просто. Красиво решаем повседневные задачиMaxim Kulsha
The document discusses various techniques for iteration in Python. It covers iterating over lists, dictionaries, files and more. It provides examples of iterating properly to avoid errors like modifying a list during iteration. Context managers are also discussed as a clean way to handle resources like file objects. Overall the document shares best practices for writing efficient and robust iteration code in Python.
This document summarizes basic operations in Matlab and Python, including programming paradigms, object-oriented fundamentals, arrays/lists, cells/structures, functions, and loops. It provides examples of classes, objects, and inheritance in both languages. Examples are also given for arrays, lists, cells, structures, functions, and loops. The document outlines the key differences between Matlab and Python for arrays, lists, and cells/structures. It concludes with references used in preparing the content.
Introduction to the Python programming language (version 2.x)
Ambient intelligence: technology and design
http://bit.ly/polito-ami
Politecnico di Torino, 2015
The basics of Python are rather straightforward. In a few minutes you can learn most of the syntax. There are some gotchas along the way that might appear tricky. This talk is meant to bring programmers up to speed with Python. They should be able to read and write Python.
This presentation covers Python most important data structures like Lists, Dictionaries, Sets and Tuples. Exception Handling and Random number generation using simple python module "random" also covered. Added simple python programs at the end of the presentation
Python is a programming language developed in 1989 that is still actively developed. It draws influences from languages like Perl, Java, C, C++, and others. Python code is portable, free, and recommended for tasks like system administration scripts, web development, scientific computing, and rapid prototyping. It has a simple syntax and is optionally object-oriented and multi-threaded. Python has extensive libraries for tasks like string manipulation, web programming, databases, and interface design. Popular applications of Python include web development, data analysis, scientific computing, and scripting.
Python quickstart for programmers: Python Kung Fuclimatewarrior
The document provides an overview of key Python concepts including data types, operators, control flow statements, functions, objects and classes. It discusses lists in depth, covering creation, iteration, searching and common list methods. It also briefly touches on modules, exceptions, inheritance and other advanced topics.
Here are the steps to solve this problem:
1. Convert both lists of numbers to sets:
set1 = {11, 2, 3, 4, 15, 6, 7, 8, 9, 10}
set2 = {15, 2, 3, 4, 15, 6}
2. Find the intersection of the two sets:
intersection = set1.intersection(set2)
3. The number of elements in the intersection is the number of similar elements:
similarity = len(intersection)
4. Print the result:
print(similarity)
The similarity between the two sets is 4, since they both contain the elements {2, 3, 4, 15}.
Python 101++: Let's Get Down to Business!Paige Bailey
You've started the Codecademy and Coursera courses; you've thumbed through Zed Shaw's "Learn Python the Hard Way"; and now you're itching to see what Python can help you do. This is the workshop for you!
Here's the breakdown: we're going to be taking you on a whirlwind tour of Python's capabilities. By the end of the workshop, you should be able to easily follow any of the widely available Python courses on the internet, and have a grasp on some of the more complex aspects of the language.
Please don't forget to bring your personal laptop!
Audience: This course is aimed at those who already have some basic programming experience, either in Python or in another high level programming language (such as C/C++, Fortran, Java, Ruby, Perl, or Visual Basic). If you're an absolute beginner -- new to Python, and new to programming in general -- make sure to check out the "Python 101" workshop!
This document provides instructions for installing Python and an overview of key Python concepts. It begins with an outline of topics to be covered, including Python datatypes, flow control, functions, files, exceptions, and projects. Detailed step-by-step instructions are given for installing Python on Windows. Short summaries are then provided of Python's history and name, the Python prompt and IDE, comments, identifiers, operators, keywords, None, as, and datatypes. Examples and explanations are provided of Python's core datatypes including numbers, strings, lists, tuples, sets, and dictionaries.
This document provides an overview of Python fundamentals including basic concepts like data types, operators, flow control, functions and classes. It begins with an introduction to Python versions and environments. The outline covers topics like Hello World, common types and operators for numeric, string and container data types. It also discusses flow control structures like if/else, while loops and for loops. Finally, it briefly mentions functions, classes, exceptions and file I/O.
- Variables in PHP are prefixed with a $ sign and can contain any type of data value. Variable names are case-sensitive.
- PHP supports scalar data types like integers, floats, booleans, and strings as well as complex types like arrays and objects. Variables do not require explicit typing.
- Arrays allow storing multiple values in a single variable through numeric or associative indexes. Arrays can be nested to any level and PHP provides many functions for manipulating array values and structure.
These are the slides of the second part of this multi-part series, from Learn Python Den Haag meetup group. It covers List comprehensions, Dictionary comprehensions and functions.
The document provides information about strings in Python. Some key points include:
- Strings are immutable sequences of characters that can be accessed using indexes. Common string methods allow operations like uppercase, lowercase, counting characters, etc.
- Strings support slicing to extract substrings, and various string formatting methods allow combining strings with variables or other strings.
- Loops can be used to iterate through strings and perform operations on individual characters. Built-in string methods do not modify the original string.
- Examples demonstrate various string operations like indexing, slicing, checking substrings, string methods, formatting and parsing strings. Loops are used to count characters in examples.
The document discusses various Python data structures and modules for working with data structures efficiently. It covers the abc module for defining abstract base classes, the array module for efficient storage of homogeneous data, the bisect module for working with sorted lists, the collections module which provides high-performance container data types like deque and defaultdict, namedtuple for creating tuple subclasses with named fields, heapq for priority queue implementation, and itertools for functions generating efficient iterators.
Python is a high-level, interpreted programming language that is designed to be easy to read and write. It has a clear syntax using English keywords and its code is often shorter than languages like C++ and Java. Python is widely used for web development, software development, science, and machine learning. It has a large standard library and can be extended through modules. Some key data structures in Python include lists, tuples, and dictionaries.
Presented at 8th Light University London (13th May 2016)
Do this, do that. Coding from assembler to shell scripting, from the mainstream languages of the last century to the mainstream languages now, is dominated by an imperative style. From how we teach variables — they vary, right? — to how we talk about databases, we are constantly looking at state as a thing to be changed and programming languages are structured in terms of the mechanics of change — assignment, loops and how code can be threaded (cautiously) with concurrency.
Functional programming, mark-up languages, schemas, persistent data structures and more are all based around a more declarative approach to code, where instead of reasoning in terms of who does what to whom and what the consequences are, relationships and uses are described, and the flow of execution follows from how functions, data and other structures are composed. This talk will look at the differences between imperative and declarative approaches, offering lessons, habits and techniques that are applicable from requirements through to code and tests in mainstream languages.
Python provides numerous built-in functions that are readily available to us at the Python prompt. Some of the functions like input() and print() are widely used for standard input and output operations respectively.
Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...Matt Harrison
I gave this presentation at Code Camp. As a data scientist and backcountry skier, I was interested in looking at fatal avalanche data. This covers scraping the data, analysis with Python, pandas and IPython Notebook. The final result is an infographic
How to Become a Tree Hugger: Random Forests and Predictive Modeling for Devel...Matt Harrison
Python makes data science easy. In this deck we walk through a complete example of creating and evaluating a predictive model using Decision Trees and Random Forests. All of the code is included in the slides.
The document introduces Python programming language. It provides an overview of Python's history and key features such as being an interpreted, object-oriented, and platform independent language. It also discusses Python syntax including data types, variables, input/output, operators, conditional statements, loops, functions, and data structures like lists, tuples, dictionaries. Several examples are given to illustrate different Python concepts and syntax.
Programming Lisp Clojure - 2장 : 클로저 둘러보기JangHyuk You
This document provides an overview of basic Clojure data types and control structures.
It describes Clojure's support for (boolean) true and false, (character) \a, (keyword) :tag, (map) {:name "Bill", :age 42}, (number) 1, 4.2, (string) "hello", and (symbol) user/foo data types.
It also summarizes commonly used control structures like if, do, loop/recur, and for and provides examples of their usage.
Python is a programming language developed in 1989 that is still actively developed. It draws influences from languages like Perl, Java, C, C++, and others. Python code is portable, free, and recommended for tasks like system administration scripts, web development, scientific computing, and rapid prototyping. It has a simple syntax and is optionally object-oriented and multi-threaded. Python has extensive libraries for tasks like string manipulation, web programming, databases, and interface design. Popular applications of Python include web development, data analysis, scientific computing, and scripting.
Python quickstart for programmers: Python Kung Fuclimatewarrior
The document provides an overview of key Python concepts including data types, operators, control flow statements, functions, objects and classes. It discusses lists in depth, covering creation, iteration, searching and common list methods. It also briefly touches on modules, exceptions, inheritance and other advanced topics.
Here are the steps to solve this problem:
1. Convert both lists of numbers to sets:
set1 = {11, 2, 3, 4, 15, 6, 7, 8, 9, 10}
set2 = {15, 2, 3, 4, 15, 6}
2. Find the intersection of the two sets:
intersection = set1.intersection(set2)
3. The number of elements in the intersection is the number of similar elements:
similarity = len(intersection)
4. Print the result:
print(similarity)
The similarity between the two sets is 4, since they both contain the elements {2, 3, 4, 15}.
Python 101++: Let's Get Down to Business!Paige Bailey
You've started the Codecademy and Coursera courses; you've thumbed through Zed Shaw's "Learn Python the Hard Way"; and now you're itching to see what Python can help you do. This is the workshop for you!
Here's the breakdown: we're going to be taking you on a whirlwind tour of Python's capabilities. By the end of the workshop, you should be able to easily follow any of the widely available Python courses on the internet, and have a grasp on some of the more complex aspects of the language.
Please don't forget to bring your personal laptop!
Audience: This course is aimed at those who already have some basic programming experience, either in Python or in another high level programming language (such as C/C++, Fortran, Java, Ruby, Perl, or Visual Basic). If you're an absolute beginner -- new to Python, and new to programming in general -- make sure to check out the "Python 101" workshop!
This document provides instructions for installing Python and an overview of key Python concepts. It begins with an outline of topics to be covered, including Python datatypes, flow control, functions, files, exceptions, and projects. Detailed step-by-step instructions are given for installing Python on Windows. Short summaries are then provided of Python's history and name, the Python prompt and IDE, comments, identifiers, operators, keywords, None, as, and datatypes. Examples and explanations are provided of Python's core datatypes including numbers, strings, lists, tuples, sets, and dictionaries.
This document provides an overview of Python fundamentals including basic concepts like data types, operators, flow control, functions and classes. It begins with an introduction to Python versions and environments. The outline covers topics like Hello World, common types and operators for numeric, string and container data types. It also discusses flow control structures like if/else, while loops and for loops. Finally, it briefly mentions functions, classes, exceptions and file I/O.
- Variables in PHP are prefixed with a $ sign and can contain any type of data value. Variable names are case-sensitive.
- PHP supports scalar data types like integers, floats, booleans, and strings as well as complex types like arrays and objects. Variables do not require explicit typing.
- Arrays allow storing multiple values in a single variable through numeric or associative indexes. Arrays can be nested to any level and PHP provides many functions for manipulating array values and structure.
These are the slides of the second part of this multi-part series, from Learn Python Den Haag meetup group. It covers List comprehensions, Dictionary comprehensions and functions.
The document provides information about strings in Python. Some key points include:
- Strings are immutable sequences of characters that can be accessed using indexes. Common string methods allow operations like uppercase, lowercase, counting characters, etc.
- Strings support slicing to extract substrings, and various string formatting methods allow combining strings with variables or other strings.
- Loops can be used to iterate through strings and perform operations on individual characters. Built-in string methods do not modify the original string.
- Examples demonstrate various string operations like indexing, slicing, checking substrings, string methods, formatting and parsing strings. Loops are used to count characters in examples.
The document discusses various Python data structures and modules for working with data structures efficiently. It covers the abc module for defining abstract base classes, the array module for efficient storage of homogeneous data, the bisect module for working with sorted lists, the collections module which provides high-performance container data types like deque and defaultdict, namedtuple for creating tuple subclasses with named fields, heapq for priority queue implementation, and itertools for functions generating efficient iterators.
Python is a high-level, interpreted programming language that is designed to be easy to read and write. It has a clear syntax using English keywords and its code is often shorter than languages like C++ and Java. Python is widely used for web development, software development, science, and machine learning. It has a large standard library and can be extended through modules. Some key data structures in Python include lists, tuples, and dictionaries.
Presented at 8th Light University London (13th May 2016)
Do this, do that. Coding from assembler to shell scripting, from the mainstream languages of the last century to the mainstream languages now, is dominated by an imperative style. From how we teach variables — they vary, right? — to how we talk about databases, we are constantly looking at state as a thing to be changed and programming languages are structured in terms of the mechanics of change — assignment, loops and how code can be threaded (cautiously) with concurrency.
Functional programming, mark-up languages, schemas, persistent data structures and more are all based around a more declarative approach to code, where instead of reasoning in terms of who does what to whom and what the consequences are, relationships and uses are described, and the flow of execution follows from how functions, data and other structures are composed. This talk will look at the differences between imperative and declarative approaches, offering lessons, habits and techniques that are applicable from requirements through to code and tests in mainstream languages.
Python provides numerous built-in functions that are readily available to us at the Python prompt. Some of the functions like input() and print() are widely used for standard input and output operations respectively.
Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...Matt Harrison
I gave this presentation at Code Camp. As a data scientist and backcountry skier, I was interested in looking at fatal avalanche data. This covers scraping the data, analysis with Python, pandas and IPython Notebook. The final result is an infographic
How to Become a Tree Hugger: Random Forests and Predictive Modeling for Devel...Matt Harrison
Python makes data science easy. In this deck we walk through a complete example of creating and evaluating a predictive model using Decision Trees and Random Forests. All of the code is included in the slides.
The document introduces Python programming language. It provides an overview of Python's history and key features such as being an interpreted, object-oriented, and platform independent language. It also discusses Python syntax including data types, variables, input/output, operators, conditional statements, loops, functions, and data structures like lists, tuples, dictionaries. Several examples are given to illustrate different Python concepts and syntax.
Programming Lisp Clojure - 2장 : 클로저 둘러보기JangHyuk You
This document provides an overview of basic Clojure data types and control structures.
It describes Clojure's support for (boolean) true and false, (character) \a, (keyword) :tag, (map) {:name "Bill", :age 42}, (number) 1, 4.2, (string) "hello", and (symbol) user/foo data types.
It also summarizes commonly used control structures like if, do, loop/recur, and for and provides examples of their usage.
Introduction to SlideShare for BusinessesSlideShare
As the global hub of professional content, SlideShare can help you or your business amplify its reach, get discovered by targeted audiences and capture more professional opportunities. Learn why you should use SlideShare for your business
How to Make Awesome SlideShares: Tips & TricksSlideShare
Turbocharge your online presence with SlideShare. We provide the best tips and tricks for succeeding on SlideShare. Get ideas for what to upload, tips for designing your deck and more.
SlideShare is a global platform for sharing presentations, infographics, videos and documents. It has over 18 million pieces of professional content uploaded by experts like Eric Schmidt and Guy Kawasaki. The document provides tips for setting up an account on SlideShare, uploading content, optimizing it for searchability, and sharing it on social media to build an audience and reputation as a subject matter expert.
Beginners python cheat sheet - Basic knowledge O T
The document provides an overview of common Python data structures and programming concepts including variables, strings, lists, tuples, dictionaries, conditionals, functions, files, classes, and more. It includes examples of how to define, access, modify, loop through, and perform operations on each type of data structure. Key points covered include using lists to store ordered sets of items, dictionaries to store connections between pieces of information as key-value pairs, and classes to define custom object types with attributes and methods.
The document provides an overview of common Python data structures and programming concepts including variables, strings, lists, tuples, dictionaries, conditionals, functions, files, classes, and more. It includes examples of how to define, access, modify, loop through, and perform operations on each type of data structure. Key points covered include using lists to store ordered sets of items, dictionaries to store connections between pieces of information as key-value pairs, and classes to define custom object types with attributes and methods.
The document provides an overview of Python lists:
- Lists allow you to store sets of information in a particular order and are one of Python's most powerful features.
- You can define lists using square brackets and commas, and use plural names for lists to make code more readable. Lists can contain millions of items.
- Lists allow adding, inserting, removing, sorting, and accessing elements by their position or value using various list methods like append(), insert(), remove(), sort(), and indexing.
- Loops like for loops efficiently iterate through lists to work with each element.
File handling in Python allows programs to read from and write to files stored on the file system. There are different modes for opening files, such as read ("r"), write ("w"), and append ("a"). Common file operations include reading, writing, updating, deleting, and creating files. Files can be opened, read from and written to, then closed. Python supports various data types that can be read from or written to files, such as text, binary, images, and audio files. File handling is an important part of building applications that need to persist data.
This document provides an overview of Python lists:
- Lists store a series of items in a particular order and allow you to access items using an index or loop through the items.
- You can add and remove items from lists, sort lists, loop through lists to print or modify items, and access items by index.
- Common list operations include appending to add an item, inserting to add an item at a specific index, removing items, sorting lists, finding the length of a list, and accessing items by index.
The document provides an overview of common Python data structures and programming concepts including:
- Strings, variables, and concatenation for combining strings
- Lists for storing ordered sets of items that can be accessed by index or looped through
- Tuples for storing immutable sets of items similar to lists
- Dictionaries for storing connections between keys and values in non-ordered key-value pairs
- Common operations for each like appending, inserting, removing, sorting, and slicing items
It also covers conditional statements, functions, files, exceptions, classes and objects, user input/output, and while and for loops for iteration. The goal is to introduce fundamental Python programming concepts and data handling techniques.
The document provides an overview of common Python data structures and programming concepts including:
- Strings, variables, and concatenation for combining strings
- Lists for storing ordered sets of items that can be accessed by index or looped through
- Tuples for storing immutable sets of items similar to lists
- Dictionaries for storing connections between keys and values in non-ordered key-value pairs
- Common operations for each like appending, inserting, removing, sorting, and slicing items
It also covers conditional statements, functions, files, exceptions, classes and objects, user input/output, and while and for loops for iteration. The goal is to introduce fundamental Python programming concepts and data structures.
This document provides an overview of Python lists:
- Lists store a series of items in a particular order and allow you to access items using an index or loop through the items.
- You can add and remove items from lists, sort lists, loop through lists to print or modify items, and access items by index.
- Common list operations include appending items, inserting items, removing items, sorting lists, finding the length of a list, and accessing items by index. Lists provide a powerful way to organize and work with sets of data in Python.
This document provides an overview of many common Python programming concepts including variables, strings, lists, tuples, dictionaries, conditionals, functions, classes, files and exceptions. It demonstrates how to store and manipulate different data types, write conditional logic, define reusable blocks of code as functions, organize code into classes and objects, read from and write to files, and handle errors through exceptions. Key examples include creating and accessing elements in lists and dictionaries, writing conditional statements, defining and calling functions, creating classes and using inheritance, opening and reading/writing files, and using try/except blocks to catch errors.
This document provides a cheat sheet on Python keywords and basic data types. It lists common Python keywords like False, True, and, or, not, break, continue, class, def, if, else, for, while, in, is, None, lambda, and return along with code examples. It also covers basic data types like Boolean, integer, float, string, list, set, dictionary, and complex data types like classes. It provides examples of using lists, sets, dictionaries, classes and functions in Python.
This document provides examples and descriptions of Python keywords and basic data types. It discusses keywords like False, True, and, or, not, break, continue, class, def, if, elif, else, for, while, in, is, None, lambda, and return. It also covers basic data types like integers, floats, strings, lists, sets, dictionaries, and Boolean values. It provides code examples to demonstrate the usage of these keywords and data types in Python.
This document discusses various Python data structures including lists, tuples, and dictionaries. It provides examples of how to use each data structure, such as appending and removing items from lists, indexing and slicing sequences, and adding/deleting key-value pairs from dictionaries. The document also covers Python references, console input using raw_input() and input(), and introduces objects and classes.
Python: легко и просто. Красиво решаем повседневные задачи.Python Meetup
The document discusses various techniques for iteration in Python. It covers iterating over lists, dictionaries, files and more. It provides examples of iterating properly to avoid errors like modifying a list during iteration. Context managers are recommended for managing resources like file handles during iteration. The document emphasizes separating administrative from business logic and using tools like generators and context managers.
Python Programming for basic beginners.pptxmohitesoham12
The document provides an overview of Python programming concepts including data types, variables, operators, and collections like lists and tuples. It defines Python as a general purpose programming language created in 1991 that can be used for desktop, web, machine learning, and data science apps. Key data types covered include numbers, strings, lists, and tuples. Operators for arithmetic, comparison, logical, membership, and identity are also summarized. Various list and tuple methods for accessing, modifying, sorting, and joining their items are demonstrated through examples.
Python Workshop - Learn Python the Hard WayUtkarsh Sengar
This document provides an introduction to learning Python. It discusses prerequisites for Python, basic Python concepts like variables, data types, operators, conditionals and loops. It also covers functions, files, classes and exceptions handling in Python. The document demonstrates these concepts through examples and exercises learners to practice char frequency counting and Caesar cipher encoding/decoding in Python. It encourages learners to practice more to master the language and provides additional learning resources.
This document discusses lists and dictionaries in Python. It provides definitions and examples of lists, including how to add and remove elements from lists. It also discusses sorting lists and getting the length of lists. Examples are provided for integrating lists with loops. The document then discusses dictionaries, including how to represent them and retrieve values from dictionaries using keys. Examples are provided for using loops to print keys and values from dictionaries. It also discusses modules like NumPy and Pandas that can be imported in Python.
This document summarizes Python basics including its features, popularity in different fields and companies, data types, control flow, containers like lists and dictionaries, NumPy for numerical computing, and classes. Python is an interpreted, general-purpose language with rich library support. It is commonly used in computer science, data analysis, biology, and academic communities. Major companies like Google, Dropbox, and Instagram use Python.
This document summarizes Python basics including its features, popularity in different fields and companies, data types, control flow, containers like lists and dictionaries, NumPy for numerical computing, and classes. Python is an interpreted, general-purpose language with rich library support. It is commonly used in computer science, data analysis, biology, and academic communities. Major companies like Google, Dropbox, and Instagram use Python.
COMPUTER SCIENCE CLASS 12 PRACTICAL FILEAnushka Rai
Here's my Computer Science Board Practical File. I hope you find it as useful as it was to me.This file is however of CBSE class 12th 2020-2021 syllabus.
This is an exit exam questions prepared for Forestry Departments from Forestry Department - Wollega University - Gimbi Campus.
The questions consists different courses such as Plantation Establishment and management, Silviculture, Forest Seed and Nursery, Biodiversity Management, Wood Processing, Forest Biometry, Dendrology, Forest Management, Agroforestry, NTFPs, Forest Ecology, Mensuration, Forest Road, Forest Protection, etc.
The question has about 100 Multiple Choice Items with its Answers. This Material will helps students and professionals of Forestry at University and college Levels.
Seismic evidence of liquid water at the base of Mars' upper crustSérgio Sacani
Liquid water was abundant on Mars during the Noachian and Hesperian periods but vanished as 17 the planet transitioned into the cold, dry environment we see today. It is hypothesized that much 18 of this water was either lost to space or stored in the crust. However, the extent of the water 19 reservoir within the crust remains poorly constrained due to a lack of observational evidence. 20 Here, we invert the shear wave velocity structure of the upper crust, identifying a significant 21 low-velocity layer at the base, between depths of 5.4 and 8 km. This zone is interpreted as a 22 high-porosity, water-saturated layer, and is estimated to hold a liquid water volume of 520–780 23 m of global equivalent layer (GEL). This estimate aligns well with the remaining liquid water 24 volume of 710–920 m GEL, after accounting for water loss to space, crustal hydration, and 25 modern water inventory.
This presentation explores the application of Discrete Choice Experiments (DCEs) to evaluate public preferences for environmental enhancements to Airthrey Loch, a freshwater lake located on the University of Stirling campus. The study aims to identify the most valued ecological and recreational improvements—such as water quality, biodiversity, and access facilities by analyzing how individuals make trade-offs among various attributes. The results provide insights for policy-makers and campus planners to design sustainable and community-preferred interventions. This work bridges environmental economics and conservation strategy using empirical, choice-based data analysis.
Transgenic Mice in Cancer Research - Creative BiolabsCreative-Biolabs
This slide centers on transgenic mice in cancer research. It first presents the increasing global cancer burden and limits of traditional therapies, then introduces the advantages of mice as model organisms. It explains what transgenic mice are, their creation methods, and diverse applications in cancer research. Case studies in lung and breast cancer prove their significance. Future innovations and Creative Biolabs' services are also covered, highlighting their role in advancing cancer research.
The Link Between Subsurface Rheology and EjectaMobility: The Case of Small Ne...Sérgio Sacani
The dynamics of crater ejecta are sensitive to the material properties of the target, much like thecrater size and morphology. We isolate and quantify the effect of target properties on the ejecta mobility (EM) ‐the maximum radial extent of ejecta scaled by the crater radius. We compile geologically motivated subsurfacestructures based on data gathered by orbiters and landers. Those structures arise from varying properties ofmaterials in single layers (strength, composition, porosity); the thickness of top regolith cover; and the sequenceand thicknesses of 3–4 stacked layers. We realize 2D simulations with the iSALE shock physics code whichresult in a 50 m diameter crater (an analog of new craters formed in the period of spacecraft observation). Wefind that varied subsurface rheologies result in EM numbers with a wide range of values between 7 and 19. Somesubsurface models can result in a similar EM, and some have distinct EMs, which shows potential for using thisquantity as a new diagnostic of target properties. We also show that ejecta dynamics are sensitive not only to thematerial in the excavation zone but also at much greater depths than commonly assumed (at least 1–2 craterradii). EM also depends on both material properties and layering: the impedance contrast governs the nature ofwave propagation, while the layer depth controls the timing of the shock wave reflection. Detailed studies of EMthus have promise for unveiling shallow subsurface rheologies on many Solar System bodies in the future.
2. The plan!
Basics: data types (and operations & calculations)
Basics: conditionals & iteration
Basics: lists, tuples, dictionaries
Basics: writing functions
Reading & writing files: opening, parsing & formats
Working with numbers: numpy & scipy
Making plots: matplotlib & pylab
… if you guys want more after all of that …
Writing better code: functions, pep8, classes
Working with numbers: Numpy & Scipy (advanced)
Other modules: Pandas & Scikit-learn
Interactive notebooks: ipython & jupyter
Advanced topics: virtual environments & version control
3. for … in … range
# the basic “for - in - range” loop
for x in range(stop):
code to repeat goes here…
it can be as long as you want!
and include, ifs, other loops, etc..
again, indentation is
everything in python!
# three ways to create a range
… range(stop)
… range(start, stop)
… range(start, stop, step)
(stop - 1)
4. okay, some exercises with loops
Basic practice:
- Write a script that asks the user for two numbers and calculates:
- The sum of all numbers between the two.
- Write a script that asks the user for a single number and calculates:
- The sum of all even numbers between 0 and that number.
A little more complex:
- Write a script that asks the user for a single number and calculates whether or not
the number is prime.
- Write a script that asks the user for a single number and finds all prime numbers
less than that number.
5. the “while loop”
---- file contents ----
# adding numbers, until we reach 100
total = 0
while total <= 100:
n = int(raw_input(“Please write a number:”))
total = total + n
print “The total exceeded 100. It is:”, total
6. the “while loop”
---- file contents ----
# adding numbers, until we reach 100
total = 0
while total <= 100:
n = int(raw_input(“Please write a number:”))
total = total + n
print “The total exceeded 100. It is:”, total
# adding numbers, until we reach 100
user_input = “”
while user_input != “stop”:
user_input = raw_input(“Type ‘stop’ to stop:”)
# the basic “while ” loop
while boolean:
code goes here
again, indentation!
7. the “while loop”
---- file contents ----
# adding numbers, until we reach 100
total = 0
while total <= 100:
n = int(raw_input(“Please write a number:”))
total = total + n
print “The total exceeded 100. It is:”, total
# adding numbers, until we reach 100
user_input = “”
while user_input != “stop”:
user_input = raw_input(“Type ‘stop’ to stop:”)
# the basic “while ” loop
while boolean:
code goes here
again, indentation!
NEVER use while loops!
okay… not “never”, but a “for loop” is
almost always better!
8. Let’s write the following variants of the lion/chair/hungry program. They start as
above, but:
- If the ‘user’ does not write ‘yes’ or ‘no’ when answering ‘hungry?’, keeps on asking
them for some useful information.
okay, juuuust one exercise using “while”
# the beginning of the lion / hungry program from last week…
chairs = int(raw_input(“How many chairs do you have?:”))
lions = int(raw_input(“How many lions are there?:”))
hungry = raw_input(“Are the lions hungry? (yes/no)?:”)
… etc…
9. data types for multiple things...
lists
[ 1, 2, 3, 100, 99 , 50]
strings
“wait, we already know these!”
tuples
(10, 11, 12, 100, 90, 80)
dictionaries
… we’ll get to those later…
10. lists!
---- file contents ----
# define a list like any other variable
# using “[” and “]” and commas:
numbers = [1, 2, 3]
print type(numbers)
# lists can contain different data...
mylist = [1, 2.0, 50.0, True, “wow”, 70, “that’s cool!”]
# lists can even have lists as elements!
awesome = [‘A’, ‘B’, [5, 3, 1], “amazing”, [“stuff”, “with”, “lists”]]
# lists can also be defined using variables (of course)
pi = 3.14
a = 100
mega_list = [50, 40, a, pi, 1, mylist]
11. indexing and slicing
---- file contents ----
# lets define a list…
numbers = [1, 2, “a”, “b”, 99, 98]
# indexing: find the 2nd
element in the list:
print numbers[1]
# remember, we start counting at 0 :)
# slicing: find the first 3 elements:
print numbers[:3]
# yap, also “n-1”
# slicing: ignore the first three elements:
print numbers[3:]
print numbers[3:5]
# what about negative numbers?
print numbers[-2]
# reassignment
numbers[3] = “X”
12. what about strings?
---- file contents ----
# lets define a string
mystring = “What if a string is basically a list of characters?”
# indexing and slicing on strings:
print mystring[8:]
print mystring[20:36]
# but … this won’t work...
mystring[8] = “A”
13. what about strings?
---- file contents ----
# lets define a string
mystring = “What if a string is basically a list of characters?”
# indexing and slicing on strings:
print mystring[8:]
print mystring[20:36]
# but … this won’t work...
mystring[8] = “A”
list
a “mutable object” (i.e., we can change the list
after creating it)
string
an “immutable object” (and cannot be
changed after creation).
14. what about tuples?
---- file contents ----
# lets define a tuple:
# note the “(” and “)”
sometuple = (1, 2, “A”, “B”, 100.0)
print type(sometuple)
# indexing and slicing on tuples:
print sometuple[3]
print sometuple[:3]
# this also won’t work...
sometuple[2] = “X”
# muuuuch better
somelist = list(sometuple)
15. what about tuples?
---- file contents ----
# lets define a tuple:
# note the “(” and “)”
sometuple = (1, 2, “A”, “B”, 100.0)
print type(sometuple)
# indexing and slicing on tuples:
print sometuple[3]
print sometuple[:3]
# this also won’t work...
sometuple[2] = “X”
# muuuuch better
somelist = list(sometuple)
tuple
is basically an “immutable” list. Its values
cannot be changed after creation.
16. what about tuples?
---- file contents ----
# lets define a tuple:
# note the “(” and “)”
sometuple = (1, 2, “A”, “B”, 100.0)
print type(sometuple)
# indexing and slicing on tuples:
print sometuple[3]
print sometuple[:3]
# this also won’t work...
sometuple[2] = “X”
# muuuuch better
somelist = list(sometuple)
tuple
is basically an “immutable” list. Its values
cannot be changed after creation.
don't use tuples
They just confuse you. Unless you
have a really good reason to make to
define an immutable object...
17. what about pancakes?
---- pancakes.py ----
# lets define a list of pancakes:
pancakes = [“strawberry”, “chocolate”,
“pineapple”, “chocolate”, “sugar”, “cream”]
# finding an element: index()
print pancakes.index(“sugar”)
print pancakes.count(“chocolate”)
# removing an element: remove()
pancakes.remove(“sugar”)
# removing and storing the last element: ()
popped = pancakes.pop()
print pancakes
print popped
# removing and storing the an element by position: ()
popped = pancakes.pop(2)
print pancakes
print popped
Using an existing list with methods:
mylist.method()
Finding things:
.index(element) ← first only
.count(element)
Removing things:
.pop(<pos>) ← returns element
.remove(element) ← first only
Adding things:
.append(element)
.insert(<pos>, element)
.extend(newlist)
Not a method, but also useful: len(list)
18. what about pancakes?
---- pancakes.py (cont) ----
# adding an element to the end: append
pancakes.append(“cherry”)
# inserting an element to the beginning
pancakes.insert(“kiwi”)
# inserting an element anywhere
pancakes.insert(3, “more kiwi”)
print pancakes
# extending one list with another
newlist = [“cheese”, “bacon”]
pancakes.extend(newlist)
print pancakes
# getting the length
print len(pancakes)
Using an existing list with methods:
mylist.method()
Finding things:
.index(element) ← first only
.count(element)
Removing things:
.pop(<pos>) ← returns element
.remove(element)
Adding things:
.append(element)
.insert(<pos>, element)
.extend(newlist)
Not a method, but also useful: len(list)
19. copying lists
---- file contents ----
# making a copy of a list:
morecakes = pancakes
pancakes.append(“banana”)
print pancakes
print morecakes
20. copying lists
---- file contents ----
# making a copy of a list:
morecakes = pancakes
pancakes.append(“banana”)
print pancakes
print morecakes
# use list() or [:] to copy a list:
anothercakes = list(pancakes)
anothercakes.remove(“banana”)
print anothercakes
print pancakes
“=” does not copy a list!
list2 = list1 ← are the same list
… use:
list2 = list(list1)
list2 = list1[:]
21. exercises!
Here is a hamburger:
First, let's remove ingredients that don’t make sense. Then, add some ingredients, and
put them into the place you think they belong. Add (at least): Tomatoes, Salad, cheese.
hamburger = ["bread", "burger", "chocolate", "bread"] # left is the bottom, right is the top :)
22. lists, loops and conditionals
---- somefile.py ----
# lets take a close look at “range”:
a = range(10)
print type(a) # (note: different in python 3)
# using lists in loops:
a = [1, 2, “a”, “b”, “hello”, 3.0, 99]
for element in a:
print element, “is of type:”, type(element)
# using lists in tests and conditionals:
mylist = [1, 2, “a”, “b”, “hello”, 99]
print “is a in the list:”, a in mylist
for a in range(100):
if a in mylist:
print a, “is in the list!”
Using in with lists:
for var in list:
do stuff in loop
if var in list:
do “True” block
else:
do “False” block
23. - How many ingredients are there in total?
- Are there any in the “stack” which are not in “pancakes” or “hamburger”? (add
these to the correct list)
- By majority vote: is it a pancake or hamburger?
hamcake!
# you should be able to copy-paste this :)
stack = [
"chocolate", "strawberries", "salad", "chocolate", "salad", "cheese", "cream", "cheese", "tomatoes", "bacon", "bacon", "tomatoes", "burger", "onions", "cheese",
"banana", "pineapple", "tomatoes", "bacon", "cheese", "burger", "salad", "tomatoes", "onions", "chocolate", "pineapple", "tomatoes", "onions", "salad",
"strawberries",
"egg", "cheese", "tomatoes", "burger", "bacon", "cream", "sugar", "burger", "ketchup", "salad", "chocolate", "cream", "egg", "sugar", "salad", "pineapple", "bacon",
"cheese", "bacon",
]
pancake = [ "chocolate", "strawberries", "chocolate", "salad", "cream", "pineapple", "sugar",]
hamburger = [ "tomatoes", "bacon", "cheese", "burger", "salad", "onions", "egg", ]