This document introduces Python programming concepts including variables, data types, numbers, booleans, strings, lists, dictionaries, control flow statements like if/else, for loops, while loops, break and continue. It discusses Python data types like integers, floats, booleans, strings, tuples, lists, sets, dictionaries, bytes and bytearrays. It provides examples and explanations of basic Python syntax and operations for these concepts.
Lectures from a Python workshop I taught in 2013 at the University of Pittsburgh. These are introductory slides to teach important aspects of the Python language.
Update: python limits the number of recursion calls, so computing the factorial as shown in the slides may not be generally usable.
Good morning Salma Hayek you have to do is your purpose of the best time to plant grass seed in the morning Salma Hayek you have to do is your purpose of the best time to plant grass seed in the morning Salma Hayek you have to do is your purpose of the best time to plant grass seed in the morning Salma Hayek you want me potter to plant in spring I will be there in the morning Salma Hayek you have a nice weekend with someone legally allowed in spring a contract for misunderstanding and tomorrow I hope it was about the best msg you want me potter you want me potter you want to do is your purpose of the best time to plant grass seed in the morning Salma Hayek you have to do it up but what do you think about the pros of the morning Salma good mornings are you doing well and tomorrow I hope it goes well and I hope you to do it goes well and tomorrow I have to be there at both locations in spring a nice day service and I hope it goes away soon as I can you have to be to get a I hope it goes away soon I hope it goes away soon I hope it goes away soon as I can you have to be to work at a time I can do is
Python programming language provides the following types of loops to handle looping requirements:
1. While
2. Do While
3. For loop
Python provides three ways for executing the loops. While all the ways provide similar basic functionality, they differ in their syntax and condition-checking time.
Python Session - 3
Escape Sequence
Data Types
Conversion between data types
Operators
Python Numbers
Python List
Python Tuple
Python Strings
Python Set
Python Dictionary
Introduction to the basics of Python programming (part 3)Pedro Rodrigues
This is the 3rd part of a multi-part series that teaches the basics of Python programming. It covers list and dict comprehensions, functions, modules and packages.
Lectures from a Python workshop I taught in 2013 at the University of Pittsburgh. These are introductory slides to teach important aspects of the Python language.
Update: python limits the number of recursion calls, so computing the factorial as shown in the slides may not be generally usable.
Good morning Salma Hayek you have to do is your purpose of the best time to plant grass seed in the morning Salma Hayek you have to do is your purpose of the best time to plant grass seed in the morning Salma Hayek you have to do is your purpose of the best time to plant grass seed in the morning Salma Hayek you want me potter to plant in spring I will be there in the morning Salma Hayek you have a nice weekend with someone legally allowed in spring a contract for misunderstanding and tomorrow I hope it was about the best msg you want me potter you want me potter you want to do is your purpose of the best time to plant grass seed in the morning Salma Hayek you have to do it up but what do you think about the pros of the morning Salma good mornings are you doing well and tomorrow I hope it goes well and I hope you to do it goes well and tomorrow I have to be there at both locations in spring a nice day service and I hope it goes away soon as I can you have to be to get a I hope it goes away soon I hope it goes away soon I hope it goes away soon as I can you have to be to work at a time I can do is
Python programming language provides the following types of loops to handle looping requirements:
1. While
2. Do While
3. For loop
Python provides three ways for executing the loops. While all the ways provide similar basic functionality, they differ in their syntax and condition-checking time.
Python Session - 3
Escape Sequence
Data Types
Conversion between data types
Operators
Python Numbers
Python List
Python Tuple
Python Strings
Python Set
Python Dictionary
Introduction to the basics of Python programming (part 3)Pedro Rodrigues
This is the 3rd part of a multi-part series that teaches the basics of Python programming. It covers list and dict comprehensions, functions, modules and packages.
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
Honest Reviews of Tim Han LMA Course Program.pptxtimhan337
Personal development courses are widely available today, with each one promising life-changing outcomes. Tim Han’s Life Mastery Achievers (LMA) Course has drawn a lot of interest. In addition to offering my frank assessment of Success Insider’s LMA Course, this piece examines the course’s effects via a variety of Tim Han LMA course reviews and Success Insider comments.
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Embracing GenAI - A Strategic ImperativePeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
2. Variables
▶ Binding between a name and an object
▶ Single variable assignment: x = 1
▶ Multi variable assignment: x, y = 1, 2
▶ Swap values: x, y = y, x
3. Data Types
▶ Numbers: int (Integers), float (Real Numbers), bool (Boolean, a subset of int)
▶ Immutable Types: str (string), tuple, bytes, frozenset
▶ Mutable Types: list, set, bytearray, dict (dictionary)
▶ Sequence Types: str, tuple, bytes, bytearray, list
▶ Determining the type of an object: type()
4. Numbers: int and float
▶ 1 + 2 (addition)
▶ 1 – 2 (subtraction)
▶ 1 * 2 (multiplication)
▶ 1 / 2 (division)
▶ 1 // 2 (integer or floor division)
▶ 3 % 2 (modulus or remainder of the division)
▶ 2**2 (power)
5. Numbers: bool (continuation)
▶ 1 > 2
▶ 1 < 2
▶ 1 == 2
▶ Boolean operations: and, or, not
▶ Objects can also be tested for their truth value. The following values are false:
None, False, zero of any numeric type, empty sequences, empty mapping
6. str (String)
▶ x = “This is a string”
▶ x = ‘This is also a string’
▶ x = “””So is this one”””
▶ x = ‘’’And this one as well’’’
▶ x = “””
This is a string that spans more
than one line. This can also be used
for comments.
“””
7. str (continuation)
▶ Indexing elements: x[0] is the first element, x[1] is the second, and so on
▶ Slicing:
▶ [start:end:step]
▶ [start:] # end is the length of the sequence, step assumed to be 1
▶ [:end] # start is the beginning of the sequence, step assumed to be 1
▶ [::step] # start is the beginning of the sequence, end is the length
▶ [start::step]
▶ [:end:step]
▶ These operations are common for all sequence types
8. str (continuation)
▶ Some common string methods:
▶ join (concatenates the strings from an iterable using the string as glue)
▶ format (returns a formatted version of the string)
▶ strip (returns a copy of the string without leading and trailing whitespace)
▶ Use help(str.<command>) in the interactive shell and dir(str)
9. Control Flow (pt. 1): if statement
▶ Compound statement
if <expression>:
suite
elif <expression2>:
suite
else:
suite
10. Control Flow (pt. 2): if statement
age = int(input(“> “))
if age >= 30:
print(“You are 30 or above”)
elif 20 < age < 30:
print(“You are in your twenties”)
else:
print(“You are less than 20”)
11. list
▶ x = [] # empty list
▶ x = [1, 2, 3] # list with 3 elements
▶ x = list(“Hello”)
▶ x.append(“something”) # append object to the end of the list
▶ x.insert(2, “something”) # append object before index 2
12. dict (Dictionaries)
▶ Mapping between keys and values
▶ Values can be of whatever type
▶ Keys must be hashable
▶ x = {} # empty dictionary
▶ x = {“Name”: “John”, “Age”: 23}
▶ x.keys()
▶ x.values()
▶ x.items()
13. Control Flow: for loop
▶ Also compound statement
▶ Iterates over the elements of an iterable object
for <target> in <expression>:
suite
else:
suite
14. Control Flow: for loop (continuation)
colors = [“red”, “green”, “blue”, “orange”]
for color in colors:
print(color)
colors = [[1, “red”], [2, “green”], [3, “blue”], [4, “orange”]]
for i, color in colors:
print(i, “ ---> “, color)
15. Control Flow: for loop (continuation)
▶ Iterable is a container object able to return its elements one at a time
▶ Iterables use iterators to return their elements one at a time
▶ Iterator is an object that represents a stream of data
▶ Must implement two methods: iter and next (Iterator protocol)
▶ Raises StopIteration when elements are exhausted
▶ Lazy evaluation
16. Challenge
▶ Rewrite the following code using enumerate and the following list of colors:
[“red”, “green”, “blue”, “orange”] .
(hint: help(enumerate))
colors = [[1, “red”], [2, “green”], [3, “blue”], [4, “orange”]]
for i, color in colors:
print(i, “ ---> “, color)
17. Control Flow: for loop (continuation)
▶ range: represents a sequence of integers
▶ range(stop)
▶ range(start, stop)
▶ range(start, stop, step)
18. Control Flow: for loop (continuation)
colors = [“red”, “green”, “orange”, “blue”]
for color in colors:
print(color)
else:
print(“Done!”)
19. Control Flow: while loop
▶ Executes the suite of statements as long as the expression evaluates to True
while <expression>:
suite
else:
suite
20. Control Flow: while loop (continuation)
counter = 5
while counter > 0:
print(counter)
counter = counter - 1
counter = 5
while counter > 0:
print(counter)
counter = counter – 1
else:
print(“Done!”)
21. Challenge
▶ Rewrite the following code using a for loop and range:
counter = 5
while counter > 0:
print(counter)
counter = counter - 1
22. Control Flow: break and continue
▶ Can only occur nested in a for or while loop
▶ Change the normal flow of execution of a loop:
▶ break stops the loop
▶ continue skips to the next iteration
for i in range(10):
if i % 2 == 0:
continue
else:
print(i)
23. Control Flow: break and (continue)
colors = [“red”, “green”, “blue”, “purple”, “orange”]
for color in colors:
if len(color) > 5:
break
else:
print(color)
24. Challenge
▶ Rewrite the following code without the if statement (hint: use the step in range)
for i in range(10):
if i % 2 == 0:
continue
else:
print(i)
25. Reading material
▶ Data Model (Python Language Reference):
https://docs.python.org/3/reference/datamodel.html
▶ Theif statement (Python Language Reference):
https://docs.python.org/3/reference/compound_stmts.html#the-if-statement
▶ Thefor statement (Python Language Reference):
https://docs.python.org/3/reference/compound_stmts.html#the-for-statement
▶ Thewhile statement (Python Language Reference):
https://docs.python.org/3/reference/compound_stmts.html#the-while-statement
26. More resources
▶ Python Tutorial: https://docs.python.org/3/tutorial/index.html
▶ Python Language Reference: https://docs.python.org/3/reference/index.html
▶ Slack channel: https://startcareerpython.slack.com/
▶ Start a Career with Python newsletter: https://www.startacareerwithpython.com/
▶ Book 15% off (NZ6SZFBL): https://www.createspace.com/6506874
27. set
▶ Unordered mutable collection of elements
▶ Doesn’t allow duplicate elements
▶ Elements must be hashable
▶ Useful to test membership
▶ x = set() # empty set
▶ x = {1, 2, 3} # set with 3 integers
▶ 2 in x # membership test
28. tuple
▶ x = 1,
▶ x = (1,)
▶ x = 1, 2, 3
▶ x = (1, 2, 3)
▶ x = (1, “Hello, world!”)
▶ You can also slice tuples
29. bytes
▶ Immutable sequence of bytes
▶ Each element is an ASCII character
▶ Integers greater than 127 must be properly escaped
▶ x = b”This is a bytes object”
▶ x = b’This is also a bytes object’
▶ x = b”””So is this”””
▶ x = b’’’or even this’’’