Based on Zed Shaw's "Learn Python the Hard Way," this is a review of Exercises 13 - 19 in that text. For non-computer-science students and learners. This PPT will not make sense without Zed's lessons. The PPT is intended to supplement and help explain these seven lessons. The PPT was updated on Jan. 17, 2014.
This Presentation Helps for the beginners to understand easily Python Programming Language, because i had given an snapshot of each concepts. Those who are knowing C,C++ and Java they can easily understand my presentation.
Learn python in easy steps. This presentation will cover followings
1. Python basics
2. How to write a python code
3. Variable usage & their syntax
4. Strings handling
5. Files handling
6. How to use loops and others.
7. Python Vs C language.
Provides an introductory level understanding of the Python Programming Language and language features. Serves as a guide for beginners and a reference to Python basics and language use cases.
This Presentation Helps for the beginners to understand easily Python Programming Language, because i had given an snapshot of each concepts. Those who are knowing C,C++ and Java they can easily understand my presentation.
Learn python in easy steps. This presentation will cover followings
1. Python basics
2. How to write a python code
3. Variable usage & their syntax
4. Strings handling
5. Files handling
6. How to use loops and others.
7. Python Vs C language.
Provides an introductory level understanding of the Python Programming Language and language features. Serves as a guide for beginners and a reference to Python basics and language use cases.
This presentation is a great resource for zero-based Python programmers who wants to learn Python 3. This course includes brief history of Python and familiarity of its basic syntax.
Python Session - 2
Install Python
Run Python
Python Keyword
Python Identifiers
Python Variables
Python Literals
Python Comments
By default Python installed on following path in Windows
C:\Users\user\AppData\Local\Programs\Python\Python37
Removing the MAX_PATH Limitation :
Windows historically has limited path lengths to 260 characters. This meant that paths longer than this would not resolve and errors would result.
In the latest versions of Windows, this limitation can be expanded to approximately 32,000 characters. Your administrator will need to activate the “Enable Win32 long paths” group policy, or set the registry value HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem@LongPathsEnabled to 1.
Python Modules
Python Package
Python File I/O
Modules refer to a file containing Python statements and definitions.
A file containing Python code, for e.g.: filename.py, is called a module and its module name would be filename.
We use modules to break down large programs into small manageable and organized files. Furthermore, modules provide reusability of code.
We can define our most used functions in a module and import it, instead of copying their definitions into different programs.
This file contains the first steps any beginner can take as he/she starts a journey into the rich and beautiful world of Python programming. From basics such as variables to data types and recursions, this document touches briefly on these concepts. It is not, by any means, an exhaustive guide to learn Python, but it serves as a good starting point and motivation.
This is the third presentation in pySIG 2015 @ BMS College of Engineering, Bangalore. The code and assignments can be found at https://github.com/pranavsb
This presentation is a great resource for zero-based Python programmers who wants to learn Python 3. This course includes brief history of Python and familiarity of its basic syntax.
Python Session - 2
Install Python
Run Python
Python Keyword
Python Identifiers
Python Variables
Python Literals
Python Comments
By default Python installed on following path in Windows
C:\Users\user\AppData\Local\Programs\Python\Python37
Removing the MAX_PATH Limitation :
Windows historically has limited path lengths to 260 characters. This meant that paths longer than this would not resolve and errors would result.
In the latest versions of Windows, this limitation can be expanded to approximately 32,000 characters. Your administrator will need to activate the “Enable Win32 long paths” group policy, or set the registry value HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem@LongPathsEnabled to 1.
Python Modules
Python Package
Python File I/O
Modules refer to a file containing Python statements and definitions.
A file containing Python code, for e.g.: filename.py, is called a module and its module name would be filename.
We use modules to break down large programs into small manageable and organized files. Furthermore, modules provide reusability of code.
We can define our most used functions in a module and import it, instead of copying their definitions into different programs.
This file contains the first steps any beginner can take as he/she starts a journey into the rich and beautiful world of Python programming. From basics such as variables to data types and recursions, this document touches briefly on these concepts. It is not, by any means, an exhaustive guide to learn Python, but it serves as a good starting point and motivation.
This is the third presentation in pySIG 2015 @ BMS College of Engineering, Bangalore. The code and assignments can be found at https://github.com/pranavsb
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...DRVaibhavmeshram1
Python
Language
is uesd in engineeringStory adapted from Stephen Covey (2004) “The Seven Habits of Highly Effective People” Simon & Schuster).
“Management is doing things right, leadership is doing the right things”
(Warren Bennis and Peter Drucker)
Story adapted from Stephen Covey (2004) “The Seven Habits of Highly Effective People” Simon & Schuster).
“Management is doing things right, leadership is doing the right things”
(Warren Bennis and Peter Drucker)
Story adapted from Stephen Covey (2004) “The Seven Habits of Highly Effective People” Simon & Schuster).
“Management is doing things right, leadership is doing the right things”
(Warren Bennis and Peter Drucker)
The Sponsor:
Champion and advocates for the change at their level in the organization.
A Sponsor is the person who won’t let the change initiative die from lack of attention, and is willing to use their political capital to make the change happen
The Role model:
Behaviors and attitudes demonstrated by them are looked upon by everyone else. . Hence, they must be willing to go first.
Employees watch leaders for consistency between words and actions to see if they should believe the change is really going to happen.
The decision maker:
Leaders usually control resources such as people, budgets, and equipment, and thus have the authority to make decisions (as per their span of control) that affect the initiative.
During change, leaders must leverage their decision-making authority and choose the options that will support the initiative.
The Decision-Maker is decisive and sets priorities that support change.
The Sponsor:
Champion and advocates for the change at their level in the organization.
A Sponsor is the person who won’t let the change initiative die from lack of attention, and is willing to use their political capital to make the change happen
The Role model:
Behaviors and attitudes demonstrated by them are looked upon by everyone else. . Hence, they must be willing to go first.
Employees watch leaders for consistency between words and actions to see if they should believe the change is really going to happen.
The decision maker:
Leaders usually control resources such as people, budgets, and equipment, and thus have the authority to make decisions (as per their span of control) that affect the initiative.
During change, leaders must leverage their decision-making authority and choose the options that will support the initiative.
The Decision-Maker is decisive and sets priorities that support change.
The Sponsor:
Champion and advocates for the change at their level in the organization.
A Sponsor is the person who won’t let the change initiative die from lack of attention, and is willing to use their political capital to make the change happen
The Role model:
Behaviors and attitudes demonstrated by them are looked upon by everyone else. . Hence, they must be willing to go first.
Employees watch leaders for consistency between words and actions to see if they s
This presentation contains basics of Python language for anyone novice to start with. Towards the end there is a brute force python script in Kali Linux.
2018 cosup-delete unused python code safely - englishJen Yee Hong
The talk is about doing cleanup and refactor for legacy Python code base in a safer way. I introduced several existing tools for this task and demonstrated how (surprisingly) Python ast module can also help in this case.
中文摘要:
不管是 open source 專案還是工作上,經過長時間開發累積,source code 內可能會殘留許多不再需要的 code,造成維護以及 refactor 的困難,也造成新手 trace code 時的障礙。
對 C/C++ 這類編譯式語言來說,開啟編譯器最佳化能自動清除 dead code,但對於 Python 這類動態語言,則沒有公認完美的方法。
本議程分享一些相關經驗,佐以利用 Python AST 的簡易自製工具,討論如何從較複雜的 python source tree 中,安全的清除不再需要的 code。
Code: https://github.com/PCMan/python-find-unused-func
This Presentation is a draft of a summary of "Learn Python The Hard Way" Book which is very helpful for anyone want to learn python from scratch of
For reading the book and do exercises, the book is available for free here: http://learnpythonthehardway.org/book/
Introduces the idea of "Just Enough Code" -- to add a 2- or 3-week module on Web coding into courses like editing, or design, or multimedia. There are 2 reasons to do this. One is to demystify how Web and mobile sites are made. The other is to open a door -- for (at least) some students -- to something they might really have an aptitude for, something they might really enjoy, if you just have a chance to explore it.
Multimedia Journalism Innovations in the ClassroomMindy McAdams
For a panel about "Innovation in Journalism Education": How teaching multimedia journalism has changed since 1999, and how I have adapted my classes and pushed my department to innovate. Journalism students don't have to be programmers, but they should have an opportunity to learn how to create new story forms for web and mobile platforms.
Summary of journalism faculty curriculum workshopMindy McAdams
At the end of a week-long workshop about updating the journalism curriculum at Rhodes University, we discussed a few specific types of assignments and assessment.
Introduction to crowdsourcing for journalists and journalism educators. Use of four cases and what we can learn from them. Three cases include maps; the fourth case does not.
Presentation about curriculum and required courses in journalism programs in the U.S. To lecturers at Rhodes dept. of Journalism and Media Studies, South Africa, June 2014.
Starter presentation in a weeklong workshop for journalism educators at Rhodes University, South Africa, in June 2014. We are trying to discover the needs of the journalism school as it goes forward with changes and updates in the curriculum. Purpose of this pres is to identify some areas where teaching needs to be focused, or refocused.
Blogs cover a very wide variety of styles and approaches. Blogs written by journalists, or housed on the websites of media organizations, are also widely varied. To understand blogs, blogging, and the audiences for blogs, we have to begin by looking at real blogs and comparing them. This presentation was given to 3rd-year journalism students at Rhodes University, South Africa.
Journalism's Future: Journalism, Not NewspapersMindy McAdams
Presentation to 150 journalists and editors at RCS MediaGroup S.p.A., Milan, Italy, May 2013. The goal was to inspire them to take their business forward into a mobile environment where competition comes from everywhere, not only the traditional rivals.
A university lecture for journalism students -- how to use the canvas element to add graphics and animation to Web pages. Updated April 2014. Basics for beginners. See also https://github.com/macloo/canvas
Updated with new exercises - March 2014. Introduction to jQuery (for journalism students) and review of the Code School "Try jQuery" course, Parts 1-3.
If you are using jQuery, you need to understand the Document Object Model and how it accounts for all the elements inside any HTML document or Web page.
An introduction to JavaScript that includes side-by-side comparisons with Python -- for journalism students. Based on the free JavaScript exercises/lessons at Codecademy: http://www.codecademy.com/tracks/javascript (Students in this course spent 4 weeks learning Python before they were introduced to JavaScript.)
An introduction to responsive design and Web frameworks -- for journalism students. Shows various examples. Includes links to resources. Updated February 2014.
Updated Feb. 9, 2014. This PPT is a review of color and fonts as used with HTML5 and CSS. Used in an undergraduate journalism class called Advanced Online Media Production.
Based on Zed Shaw's "Learn Python the Hard Way," this is a review of Exercises 27 - 34 in that text. For non-computer-science students and learners. Updated with new slides Feb. 2, 2014. Introduces Booleans, if-elif-else, loops, lists.
Based on Zed Shaw's "Learn Python the Hard Way," this is a review of Exercises 1 - 12 in that text. For non-computer-science students and learners. Updated with new slides Jan. 12, 2014. Introduces math, print statement, variables, format strings, raw_input().
Brief introduction to the Python programming language, for complete beginners who have never learned a programming language before. Resources and links are included.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
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.
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
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.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
Introduction to AI for Nonprofits with Tapp Network
Learning Python - Week 2
1. Learn Python the Hard Way
Exercises 13 – 19
http://learnpythonthehardway.org/
2. from sys import argv
• You’ll see this kind of thing a lot in Python
scripts:
from ----- import ----• The first thing (sys) is a module that already
exists in Python. It contains many things.
• The second thing (argv) is a variable that is
defined in sys. By importing it, you can do
stuff that would not work otherwise.
3. Python is flexible …
• Once you have argv in your program (because
you started with from sys import argv), you
can use it like this:
script, x, y, z = argv
• It’s entirely up to you how many things you
put in that line before = argv
4. … but Python is fussy too
• If your program has four things in the line
before = argv
script, x, y, z = argv
• … then you absolutely must invoke your
program with three arguments, like this:
~$ python ex13.py Tom Dick Harry
5.
6. from sys import argv
• Zed’s “Study Drills” are really key for learning
how this works
• Think of why a program might need this
instead of raw_input()
• Note: The “arguments” for argv are loaded
into your program before the program is
running
8. > type something here
With Zed’s Exercise 14, again, his “Study Drills”
are really important.
If you’re skipping them, you’re probably not
getting it.
You’re going to start feeling very lost …
9. Exercise 15
Opening files
f = open("myfileonmycomputer.txt")
f is a variable name (it could be x, or file, or txt)
myfileonmycomputer.txt
is the name of a normal file on your computer
open() is a built-in function in Python.
Note: This only stores the file as a value (it does NOT
show you the contents of the file).
10. Exercise 15
Opening files (2)
f = open(filename)
In Ex. 15, Zed has that (above).
Where does filename come from?
Go back to the second line of his code:
script, filename = argv
filename came from the argument you typed
when you invoked your program:
~$ python ex15.py ex15_sample.txt
11. Exercise 15
Reading files
print f.read()
What does this do?
Make sure you understand this.
read() is a method in Python. It reads what
you tell it to read, and then returns a string that
contains what it read.
12. You can play with this stuff
on the command line
13. Why this is cool
You can send Python out to the Web and ask it
to read files out there.
Then you can search the contents of those files
and do stuff with the contents.
Python is powerful.
Code is powerful!
14. Exercise 16
Messing with the contents of files
f = open(filename, 'w')
What does the ‘w’ do? Did you look it up?
f.truncate()
What does this do? (Make sure you know!)
f.write(something)
What does this do?
17. Top: The original file, test.txt. Bottom: The same file, after truncating and writing.
18. What will Python allow?
What happens if you enter:
f.write(a, b, c)
Note: You should try this kind of thing.
Write a comment in your code about what you
find out after you try it.
19. Modes for open()
f = open(filename, 'w')
Modes 'r+', 'w+' and 'a+' open the file for
updating (note that 'w+' truncates the file).
'r+' read
'w+' write and erase all contents
'a+' append
If the mode is omitted, it defaults to 'r'.
http://docs.python.org/2/library/functions.html#open
20. Exercise 17
Checking if a file exists
from sys import argv
from os.path import exists
Review Exercise 13
• The first thing (os.path) is a module that is part of
Python. It contains many things.
• The second thing (exists) is a function that is
defined in os.path. You must import it if you
intend to use it.
21. Exercise 17
Using exists
print "Does the output file exist?
%r" % exists(to_file)
If that confuses you, try just this:
print exists(to_file)
Then run the program again, and give it a
filename that does not exist on your computer.
23. Exercise 17
Copying file contents
• I think Zed’s filenames are confusing in Ex. 17.
• If you change the variable names for the two
files to: oldfile and newfile, or to original and
destination, maybe it will help you.
script, oldfile, newfile = argv
24. Exercise 17
Copying, Step 1
f = open(oldfile)
indata = f.read()
is the same as
indata = open(oldfile).read()
(Python allows us to chain instructions together
in one line)
25. Exercise 17
Copying, Step 2
t = open(newfile, 'w')
t.write(indata)
Confusing, yes?
The real file represented by newfile will now be
represented by the variable name t.
The value of indata is put into t.
Whatever was in oldfile is now in newfile.
29. Yes, Exercise 17 is hard.
Even Zed says so! *
* In his “Common Student Questions” section
30. Exercise 18
Functions!
• Functions are as essential to programming as
variables
• Most programming languages use functions
• Basically, a function has a name and a list of
instructions
• When you call the function, those instructions
will run (they will be executed)
31.
32. Exercise 18
More about functions!
• Important: A function does not do anything,
ever, until it is called
• If you define a function, but you never call it,
it will never run
• Most programs contain several (or many)
different functions
33. Exercise 18
Accurate typing
• Here’s where your journalism editing skill
gives you an edge!
• Follow the style carefully …
def functionname(argument,
argument):
(don’t forget the colon!)
• Indents: In Python, the indents are superimportant! The convention is to use 4 spaces
—and NOT a tab.
34. Exercise 19
Variables inside and outside
• Python doesn’t throw an error if you use the
exact same variable name inside a function
AND outside a function
• This can be misleading
• Those would actually be two different
variables
• If you change the value of a variable inside a
function, the value of the other variable
(outside) will not change!
35.
36. Exercise 19
Variables inside and outside
Therefore, it is very smart to be careful about
the names you give to your variables.
Don’t mix and match.
Use different variable names inside the
functions.
37. Start with the code you see below.
Then, below it, write a function that takes mpg,
price_of_gas, and distance as arguments.
The function will calculate the cost of gas for the trip.
39. Learn Python the Hard Way
Exercises 13 – 19
(now we know something)
Editor's Notes
SOURCE http://learnpythonthehardway.org/book/
All of this is just part of Python. Go with it. Relax.
You can pass in any number of arguments. For example: script, a, b, c, d, e, f, g = argv
BUT the number of arguments indicated in the program MUST BE matched by what you type when you invoke (run) the program.
CODE EXAMPLE. LPTHW Exercise 13 – this is a variation on Zed’s exercise.
Play with this code until you really understand it.
See http://en.wikipedia.org/wiki/Adventure_game | Download Mac OS version (seen here) - http://lobotomo.com/products/Adventure/index.html
LPTHW Exercise 15 – the first time we work with external files.
LPTHW Exercise 15 requires you to understand Exercises 13 and 14. If you’re still unclear about argv – you’ll have to go back. SLIDE 2 in this PPT explains.
f = open(something) does ONE thing. print f.read() does something else. For a list of all built-in functions, see http://docs.python.org/2/library/functions.html
CODE EXAMPLE. Exercise 15.
LPTHW Exercise 16 – open, truncate, write.
CODE EXAMPLE. Exercise 16. Truncate.
CODE EXAMPLE. Exercise 16. Write.
Top: The original file, test.txt. Bottom: The same file, after truncating and writing.