Lab 1: Course Intro, Getting Started with Python IDLE. Ling 1330/2330 Computational Linguistics Na-Rae Han
|
|
- Nigel Booker
- 5 years ago
- Views:
Transcription
1 Lab 1: Course Intro, Getting Started with Python IDLE Ling 1330/2330 Computational Linguistics Na-Rae Han
2 Objectives Course Introduction Student survey Introduction to Python 3 Try out Python IDLE (Interactive DeveLopment Environment) Learn Python basic syntax print command Strings Variables Learn to get around in Python IDLE Restarting IDLE session 8/28/2018 2
3 How to do well in this course 1. Be hard-working. If you are new to programming, expect to put in 4-credit worth of work. 2. Be detail-oriented. Do not skim for "important" stuff! You should learn everything. Pay attention to instructions & details when doing homework. 3. Be organized. Class moves fast, and there are a lot of assignments. 4. Be persistent. Coding has frustrating moments. Keep at it! 5. Ask for help. When you had enough of hair-pulling, /office hours. 8/28/2018 3
4 Your first code 1. Open up a new window ("File" > "New Window", or Ctrl+n). 2. Python editor window opens up. Type in: 3. Save the script as "hello.py". print('hello, world!') 4. Run the script by selecting "Run" > "Run Module" or F5. 5. Success! The command executes in the IDLE shell window. Python SCRIPT file IDLE shell (Python interpreter)
5 Scripts can be edited and saved More lines of code added to the script Script is run again; shell re-starts and then executes 8/28/2018 5
6 Following up a script in shell Variable name is available in shell for subsequent commands 8/28/2018 6
7 Try it out 1 minute 8/28/2018 7
8 Operating in shell >>> print('hello', 'world!') Hello world! >>> 4 * >>> In IDLE shell window, Python interprets and responds to each line of code you type in. called a command prompt 8/28/2018 8
9 >>> print('hello', 'world!') Hello world! >>> 4 * >>> print(4 * 12) 48 >>> * >>> 1+4*12 49 >>> (1 + 4 * 12) / >>> prints two strings as two words returns value prints value white space is optional with these operators Parentheses ( ) are used to override precedence 8/28/2018 9
10 Variable assignment Variable name >>> salary = 4500*12 >>> print(salary) Variable assignment operator Expression: variable content VALUE is what s stored, not the expression itself 8/28/
11 Printing vs. returning Prints string content >>> who = 'Homer' >>> print(who) Homer >>> who 'Homer' >>> Evaluates expression, returns the value. Value is a string: note the quotes! 8/28/
12 >>> who = 'Homer' >>> print(who) Homer >>> who 'Homer' >>> salary = 4500 *12 >>> salary >>> print(who, 'makes', salary, 'dollars a year.') Homer makes dollars a year. >>> who = 'Mr. Burns' >>> salary = 50000*12 >>> print(who, 'makes', salary, 'dollars a year.') Mr. Burns makes dollars a year. 8/28/
13 Changing variable value Variable value is declared and then changed >>> who = 'Homer' >>> print(who) Homer >>> who 'Homer' >>> salary = 4500 *12 >>> salary >>> print(who, 'makes', salary, 'dollars a year.') Homer makes dollars a year. >>> who = 'Mr. Burns' >>> salary = 50000*12 >>> print(who, 'makes', salary, 'dollars a year.') Mr. Burns makes dollars a year. 8/28/
14 Variables, variables 2 minutes >>> greet = 'Hello,' >>> nameis = 'my name is' >>> name = 'Homer' >>> print(greet, nameis, name) Hello, my name is Homer >>> >>> name = 'Marge' >>> print(greet, nameis, name) Hello, my name is Marge >>> >>> greet = 'Good morning everyone,' >>> print(greet, nameis, name) Good morning everyone, my name is Marge Same command. Use command history! Ctrl+p/n (Mac)* Alt+p/n (Win)* *It could be up/down arrows. You can also configure your IDLE. 8/28/
15 Can anything be a variable name? Answer: NO. You can use: Any letter Number, but not initially. ex: name1 is good, 1name is not Underscore "_". ex: student_name Variable names are case-sensitive! greet and Greet are two different variables. Following are built-in Python keywords and cannot be used as a variable name: and assert break class continue def del elif else except exec finally for from global if import in is lambda not or pass raise return try while yield 8/28/
16 Restarting shell Ctrl+F6 restarts IDLE shell >>> greet = 'Hello,' >>> nameis = 'my name is' >>> name = 'Homer' >>> print(greet, nameis, name) Hello, my name is Homer >>> name = 'Marge' >>> print(greet, nameis, name) Hello, my name is Marge ================================ RESTART ==================== >>> print(greet, nameis, name) Traceback (most recent call last): File "<pyshell#3>", line 1, in <module> print(greet, nameis, name) NameError: name 'greet' is not defined After RESTART, the 3 variables are no longer defined!! 8/28/
17 String vs. number: '+' and len() >>> >>> '4 + 15' '4 + 15' >>> '4' + '15' '415' >>> 'ab' + 'cde' 'abcde' >>> len('abcde') 5 >>> len('4' + '15') 3 >>> len('ab' + 'cde') 5 >>> len(4 + 15) Traceback (most recent call last): File "<pyshell#12>", line 1, in <module> len(4 + 15) TypeError: object of type 'int' has no len() 8/28/
18 String vs. number: '+' and len() >>> >>> '4 + 15' '4 + 15' >>> '4' + '15' '415' >>> 'ab' + 'cde' 'abcde' >>> len('abcde') 5 >>> len('4' + '15') 3 >>> len('ab' + 'cde') 5 >>> len(4 + 15) Traceback (most recent call last): File "<pyshell#12>", line 1, in <module> len(4 + 15) TypeError: object of type 'int' has no len() ERROR: Integers do not inherently have length! 8/28/
19 len() >>> >>> '4 + 15' '4 + 15' >>> '4' + '15' '415' >>> 'ab' + 'cde' 'abcde' >>> len('abcde') 5 >>> len('4' + '15') 3 >>> len('ab' + 'cde') 5 >>> len(4 + 15) len() returns the length of a string measured in # of characters Traceback (most recent call last): File "<pyshell#12>", line 1, in <module> len(4 + 15) TypeError: object of type 'int' has no len() 8/28/
20 +: number vs. string operation >>> >>> '4 + 15' '4 + 15' >>> '4' + '15' '415' >>> 'ab' + 'cde' 'abcde' >>> len('abcde') 5 >>> len('4' + '15') 3 >>> len('ab' + 'cde') 5 >>> len(4 + 15) 4 and 15 are integers. + is an addition operator '4' and '15' are strings of letters. + is a concatenation operator Traceback (most recent call last): File "<pyshell#12>", line 1, in <module> len(4 + 15) TypeError: object of type 'int' has no len() 8/28/
21 + vs. print >>> 'police' + 'man' 'policeman' >>> print('police', 'man') police man >>> print('police' + 'man') policeman 8/28/
22 + vs. print >>> 'police' + 'man' 'policeman' >>> print('police', 'man') police man >>> print('police' + 'man') policeman prints two strings, separated by a space prints the concatenated output as a single string 8/28/
23 +, *: overloaded operators >>> 14 * 3 42 >>> 'abc' * 3 'abcabcabc' >>> '14' * 3 '141414' >>> 'x' * 10 'xxxxxxxxxx' 8/28/
24 +, *: overloaded operators >>> 14 * 3 42 >>> 'abc' * 3 'abcabcabc' >>> '14' * 3 '141414' >>> 'x' * 10 'xxxxxxxxxx' Integers arguments. * is a multiplication operator String argument on left. * is a multi-copy concatenation operator Just like +, * also behaves differently for number and string arguments: overloaded operators 8/28/
25 + as concatenation operator >>> w1 = 'school' >>> w2 = 'bus' >>> w1+w2 'schoolbus' >>> print(w1, w2) school bus >>> print(w1+w2) schoolbus >>> w1+' '+w2 'school bus' >>> print(w1+' '+w2) school bus >>> [w1, w2] ['school', 'bus'] 8/28/
26 A list of strings >>> w1 = 'school' >>> w2 = 'bus' >>> w1+w2 'schoolbus' >>> print(w1, w2) school bus >>> print(w1+w2) schoolbus >>> w1+' '+w2 'school bus' >>> print(w1+' '+w2) school bus >>> [w1, w2] ['school', 'bus'] A list containing two strings. Square bracket [ ] marks the list data type. 8/28/
27 A string can contain a space >>> w1 = 'school' >>> w2 = 'bus' >>> w1+w2 'schoolbus' >>> print(w1, w2) school bus >>> print(w1+w2) schoolbus >>> w1+' '+w2 'school bus' >>> print(w1+' '+w2) school bus >>> [w1, w2] ['school', 'bus'] Concatenating two words with a space ' ' in between 8/28/
28 String String: a single piece of text, composed of a sequence of characters. Enclosed in ' ' or " " >>> print("it's me, Homer.") It's me, Homer. >>> print('homer says "hi."') Homer says "hi." 8/28/
29 String String: a single piece of text, composed of a sequence of characters. Enclosed in ' ' or " " >>> print("it's me, Homer.") It's me, Homer. >>> print('homer says "hi."') Homer says "hi." Enclosed in """ """ (triple double quotes) Can be multi-line! >>> print("""this is a long string that spans three lines.""") This is a long string that spans three lines. 8/28/
30 The trouble with quotation marks But how to print: >>> print("""both ' and " are ok.""") Both ' and " are ok. Method 1: Use triple double quotes """. >>> print("""both ' and " are ok.""") Both ' and " are ok. Method 2: Use backslash \ to "escape". >>> print('both \' and " are ok.') Both ' and " are ok. >>> print("both ' and \" are ok.") Both ' and " are ok.? 8/28/
31 Escaping with backslash \ >>> print('it\'s snowing.') It's snowing. >>> print('lala\tlala') lala lala >>> print('lala\nlala') lala lala >>> multi = """This is a long string across multiple lines.""" >>> print(multi) This is a long string across multiple lines. >>> multi 'This is a\nlong string across\nmultiple lines.' 8/28/
32 Escaping with backslash \ >>> print('it\'s snowing.') It's snowing. >>> print('lala\tlala') lala lala >>> print('lala\nlala') lala lala >>> multi = """This is a long string across multiple lines.""" >>> print(multi) This is a long string across multiple lines. >>> multi 'This is a\nlong string across\nmultiple lines.' 8/28/
33 Special character and \ Prefixing backslash \ (=escaping) turns: A special character into a normal one SPECIAL NORMAL ' String delimiter \' Single quote character " String delimiter \" Double quote character \ Escape marker \\ Backslash character A normal character into a special one NORMAL SPECIAL n Alphabet n \n New line character t Alphabet t \t Tab character 8/28/
34 Practice 2 minutes Compose print commands to output the following: >>> print('look in C:\\temp\\note.') Look in C:\temp\note. >>> print('lisa said \'Look in C:\\temp\\note\'.') Lisa said 'Look in C:\temp\note'. >>> print('lisa said \'Look in C:\\temp\\note and find "my.txt".\'') Lisa said 'Look in C:\temp\note and find "my.txt"'. >>> print('roses are red,\nviolets are blue,\nsugar is sweet.') Roses are red, Violets are blue, Sugar is sweet. 8/28/
35 Practice 2 minutes Compose print commands to output the following: >>> print('look in C:\\temp\\note.') Look in C:\temp\note. >>> print('lisa said \'Look in C:\\temp\\note\'.') Lisa said 'Look in C:\temp\note'. >>> print('lisa said \'Look in C:\\temp\\note and find "my.txt".\'') Lisa said 'Look in C:\temp\note and find "my.txt"'. >>> print('roses are red,\nviolets are blue,\nsugar is sweet.') Roses are red, Violets are blue, Sugar is sweet. 8/28/
36 Wrap-up Exercise #1 Review today's lesson Learn on your own: String Methods 1, Boolean Operators Due 30 mins before next class (=Thu 4pm) Friday recitation Will send individual tomorrow. Python installation/configuration: make sure you followed all instructions in "Getting Started" sections Next class More Python practice Study Tutorials 5, 7, 16, 17, 18 and Additional Topics 1, 2, 3 before class New to programming? Try to log a few additional hours! 8/28/
Lab 6: Data Types, Mutability, Sorting. Ling 1330/2330: Computational Linguistics Na-Rae Han
Lab 6: Data Types, Mutability, Sorting Ling 1330/2330: Computational Linguistics Na-Rae Han Objectives Data types and conversion Tuple Mutability Sorting: additional parameters Text processing overview
More informationLab 2: input(), if else, String Operations, Variable Assignment. Ling 1330/2330: Computational Linguistics Na-Rae Han
Lab 2: input(), if else, String Operations, Variable Assignment Ling 1330/2330: Computational Linguistics Na-Rae Han Objectives Learn Python basics Taking input from keyboard with input() Commenting Comparison
More informationGetting Started with Python
Fundamentals of Programming (Python) Getting Started with Python Sina Sajadmanesh Sharif University of Technology Some slides have been adapted from Python Programming: An Introduction to Computer Science
More informationPython I. Some material adapted from Upenn cmpe391 slides and other sources
Python I Some material adapted from Upenn cmpe391 slides and other sources Overview Names & Assignment Data types Sequences types: Lists, Tuples, and Strings Mutability Understanding Reference Semantics
More informationCSCE 110 Programming I Basics of Python: Variables, Expressions, Input/Output
CSCE 110 Programming I Basics of Python: Variables, Expressions, Input/Output Dr. Tiffani L. Williams Department of Computer Science and Engineering Texas A&M University Spring 2011 Python Python was developed
More informationFundamentals of Programming (Python) Getting Started with Programming
Fundamentals of Programming (Python) Getting Started with Programming Ali Taheri Sharif University of Technology Some slides have been adapted from Python Programming: An Introduction to Computer Science
More informationThere are two ways to use the python interpreter: interactive mode and script mode. (a) open a terminal shell (terminal emulator in Applications Menu)
I. INTERACTIVE MODE VERSUS SCRIPT MODE There are two ways to use the python interpreter: interactive mode and script mode. 1. Interactive Mode (a) open a terminal shell (terminal emulator in Applications
More informationCSCE 110 Programming I
CSCE 110 Programming I Basics of Python (Part 1): Variables, Expressions, and Input/Output Dr. Tiffani L. Williams Department of Computer Science and Engineering Texas A&M University Spring 2013 Tiffani
More informationGetting Started Values, Expressions, and Statements CS GMU
Getting Started Values, Expressions, and Statements CS 112 @ GMU Topics where does code go? values and expressions variables and assignment 2 where does code go? we can use the interactive Python interpreter
More informationIntroduction to Python
Introduction to Python Reading assignment: Perkovic text, Ch. 1 and 2.1-2.5 Python Python is an interactive language. Java or C++: compile, run Also, a main function or method Python: type expressions
More informationIntroduction to Computer Programming CSCI-UA 2. Review Midterm Exam 1
Review Midterm Exam 1 Review Midterm Exam 1 Exam on Monday, October 7 Data Types and Variables = Data Types and Variables Basic Data Types Integers Floating Point Numbers Strings Data Types and Variables
More informationLesson 4: Type Conversion, Mutability, Sequence Indexing. Fundamentals of Text Processing for Linguists Na-Rae Han
Lesson 4: Type Conversion, Mutability, Sequence Indexing Fundamentals of Text Processing for Linguists Na-Rae Han Objectives Python data types Mutable vs. immutable object types How variable assignment
More informationThere are two ways to use the python interpreter: interactive mode and script mode. (a) open a terminal shell (terminal emulator in Applications Menu)
I. INTERACTIVE MODE VERSUS SCRIPT MODE There are two ways to use the python interpreter: interactive mode and script mode. 1. Interactive Mode (a) open a terminal shell (terminal emulator in Applications
More informationGetting Started. Office Hours. CSE 231, Rich Enbody. After class By appointment send an . Michigan State University CSE 231, Fall 2013
CSE 231, Rich Enbody Office Hours After class By appointment send an email 2 1 Project 1 Python arithmetic Do with pencil, paper and calculator first Idle Handin Help room 3 What is a Computer Program?
More informationTable of Contents EVALUATION COPY
Table of Contents Introduction... 1-2 A Brief History of Python... 1-3 Python Versions... 1-4 Installing Python... 1-5 Environment Variables... 1-6 Executing Python from the Command Line... 1-7 IDLE...
More informationSome material adapted from Upenn cmpe391 slides and other sources
Some material adapted from Upenn cmpe391 slides and other sources History Installing & Running Python Names & Assignment Sequences types: Lists, Tuples, and Strings Mutability Understanding Reference Semantics
More informationENGR 101 Engineering Design Workshop
ENGR 101 Engineering Design Workshop Lecture 2: Variables, Statements/Expressions, if-else Edgardo Molina City College of New York Literals, Variables, Data Types, Statements and Expressions Python as
More informationNot-So-Mini-Lecture 6. Modules & Scripts
Not-So-Mini-Lecture 6 Modules & Scripts Interactive Shell vs. Modules Launch in command line Type each line separately Python executes as you type Write in a code editor We use Atom Editor But anything
More informationIntroduction to: Computers & Programming: Review prior to 1 st Midterm
Introduction to: Computers & Programming: Review prior to 1 st Midterm Adam Meyers New York University Summary Some Procedural Matters Summary of what you need to Know For the Test and To Go Further in
More informationInteractive use. $ python. >>> print 'Hello, world!' Hello, world! >>> 3 $ Ctrl-D
1/60 Interactive use $ python Python 2.7.5 (default, Mar 9 2014, 22:15:05) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information.
More informationPython for Non-programmers
Python for Non-programmers A Gentle Introduction 1 Yann Tambouret Scientific Computing and Visualization Information Services & Technology Boston University 111 Cummington St. yannpaul@bu.edu Winter 2013
More informationBasic Syntax - First Program 1
Python Basic Syntax Basic Syntax - First Program 1 All python files will have extension.py put the following source code in a test.py file. print "Hello, Python!";#hello world program run this program
More informationHistory Installing & Running Python Names & Assignment Sequences types: Lists, Tuples, and Strings Mutability
History Installing & Running Python Names & Assignment Sequences types: Lists, Tuples, and Strings Mutability Some material adapted from Upenn cmpe391 slides and other sources Invented in the Netherlands,
More informationInteractive use. $ python. >>> print 'Hello, world!' Hello, world! >>> 3 $ Ctrl-D
1/58 Interactive use $ python Python 2.7.5 (default, Mar 9 2014, 22:15:05) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information.
More informationLab 8: File I/O, Mutability vs. Assignment. Ling 1330/2330: Intro to Computational Linguistics Na-Rae Han
Lab 8: File I/O, Mutability vs. Assignment Ling 1330/2330: Intro to Computational Linguistics Na-Rae Han Objectives File I/O Writing to a file File I/O pitfalls File reference and absolute path Mutability
More informationProgramming for Engineers in Python. Recitation 1
Programming for Engineers in Python Recitation 1 Plan Administration: Course site Homework submission guidelines Working environment Python: Variables Editor vs. shell Homework 0 Python Cont. Conditional
More informationProgramming for Engineers in Python. Autumn
Programming for Engineers in Python Autumn 2011-12 Plan Administration: Course site Homework submission guidelines Working environment Python: Variables Editor vs. shell Homework 0 Python Cont. Conditional
More informationVariables, expressions and statements
Variables, expressions and statements 2.1. Values and data types A value is one of the fundamental things like a letter or a number that a program manipulates. The values we have seen so far are 2 (the
More informationCHAPTER 2: Introduction to Python COMPUTER PROGRAMMING SKILLS
CHAPTER 2: Introduction to Python COMPUTER PROGRAMMING SKILLS 1439-1440 1 Outline 1. Introduction 2. Why Python? 3. Compiler and Interpreter 4. The first program 5. Comments and Docstrings 6. Python Indentations
More informationReview. Input, Processing and Output. Review. Review. Designing a Program. Typical Software Development cycle. Bonita Sharif
Input, Processing and Output Bonita Sharif 1 Review A program is a set of instructions a computer follows to perform a task The CPU is responsible for running and executing programs A set of instructions
More information6.S189 Homework 1. What to turn in. Exercise 1.1 Installing Python. Exercise 1.2 Hello, world!
6.S189 Homework 1 http://web.mit.edu/6.189/www/materials.html What to turn in Do the warm-up problems for Days 1 & 2 on the online tutor. Complete the problems below on your computer and get a checkoff
More informationCMSC 201 Computer Science I for Majors
CMSC 201 Computer Science I for Majors Lecture 02 Intro to Python Syllabus Last Class We Covered Grading scheme Academic Integrity Policy (Collaboration Policy) Getting Help Office hours Programming Mindset
More informationCSCI 121: Anatomy of a Python Script
CSCI 121: Anatomy of a Python Script Python Scripts We start by a Python script: A text file containing lines of Python code. Each line is a Python statement. The Python interpreter (the python3 command)
More informationPython Intro GIS Week 1. Jake K. Carr
GIS 5222 Week 1 Why Python It s simple and easy to learn It s free - open source! It s cross platform IT S expandable!! Why Python: Example Consider having to convert 1,000 shapefiles into feature classes
More informationLab 3: for and while Loops, Indexing. Ling 1330/2330: Computational Linguistics Na-Rae Han
Lab 3: for and while Loops, Indexing Ling 1330/2330: Computational Linguistics Na-Rae Han Objectives Split vs. join Loops for loop while loop Indexing List and string indexing & slicing Tips How to program
More informationVariable and Data Type I
The Islamic University of Gaza Faculty of Engineering Dept. of Computer Engineering Intro. To Computers (LNGG 1003) Lab 2 Variable and Data Type I Eng. Ibraheem Lubbad February 18, 2017 Variable is reserved
More informationWays to Fail this Class. Welcome! Questions? Course Policies. CSC 9010: Natural Language Processing. Who / what / where / when / why / how 1/9/2014
Welcome! About me Max Peysakhov, Adjunct Faculty, CS Email: mpeysakhov@gmail.com Office: N/A Office hours:wed 5-6PM, or email for appt. About this course Syllabus, timeline, & resources on-line... http://edge.cs.drexel.edu/people/peysakhov/classes/cs260/
More informationPYTHON FOR KIDS A Pl ayfu l I ntrodu ctio n to Prog r am m i ng J a s o n R. B r i g g s
PYTHON FO R K I D S A P l ay f u l I n t r o d u c t i o n to P r o g r a m m i n g Jason R. Briggs Index Symbols and Numbers + (addition operator), 17 \ (backslash) to separate lines of code, 235 in strings,
More informationLecture 4: Basic I/O
Lecture 4: Basic I/O CS1068+ Introductory Programming in Python Dr Kieran T. Herley Department of Computer Science University College Cork 2017-2018 KH (21/09/17) Lecture 4: Basic I/O 2017-2018 1 / 20
More informationCS1 Lecture 3 Jan. 22, 2018
CS1 Lecture 3 Jan. 22, 2018 Office hours for me and for TAs have been posted, locations will change check class website regularly First homework available, due Mon., 9:00am. Discussion sections tomorrow
More informationJython. secondary. memory
2 Jython secondary memory Jython processor Jython (main) memory 3 Jython secondary memory Jython processor foo: if Jython a
More informationIntroduction to Python, Cplex and Gurobi
Introduction to Python, Cplex and Gurobi Introduction Python is a widely used, high level programming language designed by Guido van Rossum and released on 1991. Two stable releases: Python 2.7 Python
More information\n is used in a string to indicate the newline character. An expression produces data. The simplest expression
Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of
More informationPart III Appendices 165
Part III Appendices 165 Appendix A Technical Instructions Learning Outcomes This material will help you learn how to use the software you need to do your work in this course. You won t be tested on it.
More informationage = 23 age = age + 1 data types Integers Floating-point numbers Strings Booleans loosely typed age = In my 20s
Intro to Python Python Getting increasingly more common Designed to have intuitive and lightweight syntax In this class, we will be using Python 3.x Python 2.x is still very popular, and the differences
More informationOverview. - General Data Types - Categories of Words. - Define Before Use. - The Three S s. - End of Statement - My First Program
Overview - General Data Types - Categories of Words - The Three S s - Define Before Use - End of Statement - My First Program a description of data, defining a set of valid values and operations List of
More informationConstants. Variables, Expressions, and Statements. Variables. x = 12.2 y = 14 x = 100. Chapter
Variables, Expressions, and Statements Chapter 2 Unless otherwise noted, the content of this course material is licensed under a Creative Commons Attribution 3.0 License. http://creativecommons.org/licenses/by/3.0/.
More informationVariable and Data Type I
Islamic University Of Gaza Faculty of Engineering Computer Engineering Department Lab 2 Variable and Data Type I Eng. Ibraheem Lubbad September 24, 2016 Variable is reserved a location in memory to store
More informationIntroduction to programming with Python
Introduction to programming with Python Ing. Lelio Campanile 1/61 Main Goal - Introduce you to programming - introduce you to the most essential feature of python programming 2/61 Before to start The name
More informationThe Three Rules. Program. What is a Computer Program? 5/30/2018. Interpreted. Your First Program QuickStart 1. Chapter 1
The Three Rules Chapter 1 Beginnings Rule 1: Think before you program Rule 2: A program is a human-readable essay on problem solving that also executes on a computer Rule 3: The best way to improve your
More informationVariables, Expressions, and Statements
Variables, Expressions, and Statements Chapter 2 Python for Informatics: Exploring Information www.pythonlearn.com Constants Fixed values such as numbers, letters, and strings are called constants because
More informationChapter 2 Writing Simple Programs
Chapter 2 Writing Simple Programs Charles Severance Textbook: Python Programming: An Introduction to Computer Science, John Zelle (www.si182.com) Software Development Process Figure out the problem - for
More informationIntro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming
Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals
More informationSTEAM Clown & Productions Copyright 2017 STEAM Clown. Page 1
What to add next time you are updating these slides Update slides to have more animation in the bullet lists Verify that each slide has stand alone speaker notes Page 1 Python 3 Running The Python Interpreter
More informationProgramming Fundamentals and Python
Chapter 2 Programming Fundamentals and Python This chapter provides a non-technical overview of Python and will cover the basic programming knowledge needed for the rest of the chapters in Part 1. It contains
More informationSAMS Programming A/B. Lecture #1 Introductions July 3, Mark Stehlik
SAMS Programming A/B Lecture #1 Introductions July 3, 2017 Mark Stehlik Outline for Today Overview of Course A Python intro to be continued in lab on Wednesday (group A) and Thursday (group B) 7/3/2017
More informationShort, Unique and Mysterious
Short, Unique and Mysterious Q Why is the Programming Language named so? a Monty Python's Flying Circus "A t t h e t i m e w h e n h e b e g a n implementing Python, Guido van R o s s u m w a s a l s o
More informationDEBUGGING TIPS. 1 Introduction COMPUTER SCIENCE 61A
DEBUGGING TIPS COMPUTER SCIENCE 61A 1 Introduction Every time a function is called, Python creates what is called a stack frame for that specific function to hold local variables and other information.
More informationLecture 3. Functions & Modules
Lecture 3 Functions & Modules Labs this Week Lab 1 is due at the beginning of your lab If it is not yet by then, you cannot get credit Only exception is for students who added late (Those students should
More informationAccelerating Information Technology Innovation
Accelerating Information Technology Innovation http://aiti.mit.edu/program/philippines-summer-2012/ Philippines Summer 2012 Lecture 1 Introduction to Python June 19, 2012 Agenda About the Course What is
More informationLab 18: Regular Expressions in Python. Ling 1330/2330: Intro to Computational Linguistics Na-Rae Han
Lab 18: Regular Expressions in Python Ling 1330/2330: Intro to Computational Linguistics Na-Rae Han Learning to use regex in Python Na-Rae's tutorials: http://www.pitt.edu/~naraehan/python3/re.html http://www.pitt.edu/~naraehan/python3/more_list_comp.html
More informationExpressions and Data Types CSC 121 Spring 2015 Howard Rosenthal
Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types
More informationPython language: Basics
Python language: Basics The FOSSEE Group Department of Aerospace Engineering IIT Bombay Mumbai, India FOSSEE Team (FOSSEE IITB) Basic Python 1 / 45 Outline 1 Data types Numbers Booleans Strings 2 Operators
More informationCS 1110 SPRING 2016: GETTING STARTED (Jan 27-28) First Name: Last Name: NetID:
CS 1110 SPRING 2016: GETTING STARTED (Jan 27-28) http://www.cs.cornell.edu/courses/cs1110/2016sp/labs/lab01/lab01.pdf First Name: Last Name: NetID: Goals. Learning a computer language is a lot like learning
More informationPHP and MySQL for Dynamic Web Sites. Intro Ed Crowley
PHP and MySQL for Dynamic Web Sites Intro Ed Crowley Class Preparation If you haven t already, download the sample scripts from: http://www.larryullman.com/books/phpand-mysql-for-dynamic-web-sitesvisual-quickpro-guide-4thedition/#downloads
More information06/11/2014. Subjects. CS Applied Robotics Lab Gerardo Carmona :: makeroboticsprojects.com June / ) Beginning with Python
CS95003 - Applied Robotics Lab Gerardo Carmona :: makeroboticsprojects.com June / 2014 Subjects 1) Beginning with Python 2) Variables 3) Strings 4) Basic arithmetic operators 5) Flow control 6) Comparison
More informationContents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual
Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual Contents 1 Introduction...2 2 Lexical Conventions...2 3 Types...3 4 Syntax...3 5 Expressions...4 6 Declarations...8 7 Statements...9
More informationCSE : Python Programming
CSE 399-004: Python Programming Lecture 2: Data, Classes, and Modules January 22, 2007 http://www.seas.upenn.edu/~cse39904/ Administrative things Teaching assistant Brian Summa (bsumma @ seas.upenn.edu)
More informationLecture 3: Variables and assignment
Lecture 3: Variables and assignment CSC 1051 Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website: www.csc.villanova.edu/~map/1051/
More informationProgramming with Python
Programming with Python Dr Ben Dudson Department of Physics, University of York 21st January 2011 http://www-users.york.ac.uk/ bd512/teaching.shtml Dr Ben Dudson Introduction to Programming - Lecture 2
More informationPython for ArcGIS. Lab 1.
Python for ArcGIS. Lab 1. Python is relatively new language of programming, which first implementation arrived around early nineties of the last century. It is best described as a high level and general
More informationLaboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++
Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++ 0.1 Introduction This is a session to familiarize working with the Visual Studio development environment. It
More informationAlgorithms and Programming I. Lecture#12 Spring 2015
Algorithms and Programming I Lecture#12 Spring 2015 Think Python How to Think Like a Computer Scientist By :Allen Downey Installing Python Follow the instructions on installing Python and IDLE on your
More information>>> * *(25**0.16) *10*(25**0.16)
#An Interactive Session in the Python Shell. #When you type a statement in the Python Shell, #the statement is executed immediately. If the #the statement is an expression, its value is #displayed. #Lines
More informationPROGRAMMING FUNDAMENTALS
PROGRAMMING FUNDAMENTALS VARIABLES, EXPRESSIONS AND STATEMENTS João Correia Lopes INESC TEC, FEUP 27 September 2018 FPRO/MIEIC/2018-19 27/09/2018 1 / 21 INTRODUCTION GOALS By the end of this class, the
More informationMEIN 50010: Python Introduction
: Python Fabian Sievers Higgins Lab, Conway Institute University College Dublin Wednesday, 2017-10-04 Outline Goals Teach basic programming concepts Apply these concepts using Python Use Python Packages
More informationLecture 3. Strings, Functions, & Modules
Lecture 3 Strings, Functions, & Modules Labs this Week Lab 1 is due at the beginning of your lab If it is not yet by then, you cannot get credit Only exception is for students who added late (Those students
More informationCS1 Lecture 3 Jan. 18, 2019
CS1 Lecture 3 Jan. 18, 2019 Office hours for Prof. Cremer and for TAs have been posted. Locations will change check class website regularly First homework assignment will be available Monday evening, due
More informationStarting. Read: Chapter 1, Appendix B from textbook.
Read: Chapter 1, Appendix B from textbook. Starting There are two ways to run your Python program using the interpreter 1 : from the command line or by using IDLE (which also comes with a text editor;
More informationChapter 3 : Informatics Practices. Class XI ( As per CBSE Board) Python Fundamentals. Visit : python.mykvs.in for regular updates
Chapter 3 : Informatics Practices Class XI ( As per CBSE Board) Python Fundamentals Introduction Python 3.0 was released in 2008. Although this version is supposed to be backward incompatibles, later on
More informationSI Networked Computing: Storage, Communication, and Processing, Winter 2009
University of Michigan Deep Blue deepblue.lib.umich.edu 2009-01 SI 502 - Networked Computing: Storage, Communication, and Processing, Winter 2009 Severance, Charles Severance, C. (2008, December 19). Networked
More informationBasic Concepts. Computer Science. Programming history Algorithms Pseudo code. Computer - Science Andrew Case 2
Basic Concepts Computer Science Computer - Science - Programming history Algorithms Pseudo code 2013 Andrew Case 2 Basic Concepts Computer Science Computer a machine for performing calculations Science
More informationChapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines.
Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of
More informationPython BASICS. Introduction to Python programming, basic concepts: formatting, naming conventions, variables, etc.
Python BASICS Introduction to Python programming, basic concepts: formatting, naming conventions, variables, etc. Identikit First appeared in 1991 Designed by Guido van Rossum General purpose High level
More informationThere are four numeric types: 1. Integers, represented as a 32 bit (or longer) quantity. Digits sequences (possibly) signed are integer literals:
Numeric Types There are four numeric types: 1. Integers, represented as a 32 bit (or longer) quantity. Digits sequences (possibly) signed are integer literals: 1-123 +456 2. Long integers, of unlimited
More informationChapter 2 Working with Data Types and Operators
JavaScript, Fourth Edition 2-1 Chapter 2 Working with Data Types and Operators At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics
More informationnostarch.com/pfk For bulk orders, please contact us at
nostarch.com/pfk For bulk orders, please contact us at sales@nostarch.com. Teacher: Date/Period: Subject: Python Programming Class: Topic: #1 - Getting Started Duration: Up to 50 min. Objectives: Install
More informationfrom scratch A primer for scientists working with Next-Generation- Sequencing data Chapter 1 Text output and manipulation
from scratch A primer for scientists working with Next-Generation- Sequencing data Chapter 1 Text output and manipulation Chapter 1: text output and manipulation In this unit you will learn how to write
More informationIntroduction to Python! Lecture 2
.. Introduction to Python Lecture 2 Summary Summary: Lists Sets Tuples Variables while loop for loop Functions Names and values Passing parameters to functions Lists Characteristics of the Python lists
More informationAnnouncements For This Lecture
Lecture 5 Strings Announcements For This Lecture Assignment 1 Will post it on Sunday Need one more lecture But start reading it Dues Wed Sep. 19 th Revise until correct This is Yom Kippur This is as late
More informationCS 1110, LAB 1: PYTHON EXPRESSIONS.
CS 1110, LAB 1: PYTHON EXPRESSIONS Name: Net-ID: There is an online version of these instructions at http://www.cs.cornell.edu/courses/cs1110/2012fa/labs/lab1 You may wish to use that version of the instructions.
More informationAccelerating Information Technology Innovation
Accelerating Information Technology Innovation http://aiti.mit.edu Cali, Colombia Summer 2012 Lesson 1 Introduction to Python Agenda What is Python? and Why Python? Basic Syntax Strings User Input Useful
More informationLecture 3. Functions & Modules
Lecture 3 Functions & Modules Labs this Week Lab 1 is due at the beginning of your lab If it is not yet by then, you cannot get credit Only exception is for students who added late (Those students should
More informationLecture 1. basic Python programs, defining functions
Lecture 1 basic Python programs, defining functions Lecture notes modified from CS Washington CS 142 Except where otherwise noted, this work is licensed under: http://creativecommons.org/licenses/by-nc-sa/3.0
More informationThe current topic: Python. Announcements. Python. Python
The current topic: Python Announcements! Introduction! reasons for studying languages! language classifications! simple syntax specification Object-oriented programming: Python Types and values Syntax
More informationBeyond Blocks: Python Session #1
Beyond Blocks: Session #1 CS10 Spring 2013 Thursday, April 30, 2013 Michael Ball Beyond Blocks : : Session #1 by Michael Ball adapted from Glenn Sugden is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike
More informationGetting started 7. Saving data 23
Contents 1 2 3 4 Getting started 7 Programming code 8 Setting up 10 Exploring IDLE 12 Getting help 14 Saving programs 16 Storing values 18 Adding comments 20 Naming rules 21 Summary 22 Saving data 23 Storing
More informationChapter 2: Programming Concepts
Chapter 2: Programming Concepts Objectives Students should Know the steps required to create programs using a programming language and related terminology. Be familiar with the basic structure of a Java
More informationCMSC201 Computer Science I for Majors
CMSC201 Computer Science I for Majors Lecture 09 Strings Last Class We Covered Lists and what they are used for Getting the length of a list Operations like append() and remove() Iterating over a list
More informationStrings. CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington
Strings CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1 Strings Store Text In the same way that int and float are designed to store numerical values,
More information