Python Programming. Introduction Part II
|
|
- Osborn Bradford
- 5 years ago
- Views:
Transcription
1 Python Programming Introduction Part II
2 Type Conversion One data type > another data type Example: int > float, int > string. >>> a = 5.5 >>> b = int(a) >>> print(b) 5 >>>> print(a) 5.5 Conversion from int to float and stored at b but original value does not change.
3 Types of Conversion q Implicit Type Conversion q Explicit Type Conversion Ø Implicit Type conversion or automatic type conversion Automatically converts one data type to another type num_int = 123 num_float = 2.35 new_num = num_int + num_float print(new_num) output: print(type(new_num)) < class float >
4 Explicit conversion Example: num_int = 234 num_str = 100 print(num_int + num_str) output: TypeError: unsupported operand type(s) for +: int and str This is because python can not do implicit conversion in such condition.
5 Explicit conversion User converts the data type of an object to required data type using predefined data types. This process is called typecasting Syntax: Required_datatype (Expression) Example: num_int = 234 num_str = 100 num_str = int(num_str) print(num_int + num_str) Output: 334
6 Python Input, Output and Import Python has many built-in functions to perform I/O tasks. Examples: abs() > returns absolute value of a number. abs(-5) > 5. int() > returns integer from a number or string. int(3.5) > 3 input() > standard input print() > standard output
7 q Input() Input() function gets data from the user. Syntax of Input(): input([prompt]) prompt is the screen we want to display in the screen. num = input( Enter a number: ) Enter a number: 5 print(num) 5
8 q Output() print() is used to output data to standard output. Examples: print( Welcome to class ) output: Welcome to class x = 100 print(x) output: 100
9 By default python s print function ends with a newline. C/C++ programmer may wonder how to print without newline. print( welcome to seminar, end = ) welcome to seminar print( welcome to seminar, end ) print( UTEP ) welcome to UTEP Print(5,5,sep= * ) 5*5
10 Output Formatting Output formatting can be done using str.format() method. a = 5; b = 6 print( The value of a is {} and b is {}.format(a,b)) The value of a is 5 and b is 6 print( I love {1} {0}.format( programming, python )) I love python programming print( The value of a is %d %a) The value of a is 5
11 Arithmetic operators: Operators in Python Operators are special symbols in python used for arithmetic and logical computation. The values that the operator operates on are called operands + operator > addition >>> Other Examples: -, *, / %, //, ** %, modulus operator returns the remainder of the division. // Floor division- returns the whole number adjusted to the left in the number line. Example: 2//3 0
12 Comparison Operators Used to compare the results ==, Eaual to - True if both operands are equal. >, <, ==,!=, <=, >= a =10 b = 11 print(a>b) False
13 Logical Operators Logical operators are the and, or, not operators. Operator Meaning Example and True if both the operands are true x and y or True if either of the operands is true x or y not True if operand is False. not x x = True y = False print(x or y) True Other operators: Bitwise operators, Assignment operators and special operators such as Identity operators, Membership operators.
14 Namespace and Scope What is Name in python? Name is just a name or identifier given to an object. Example x = 3 3 is an object and x is a name. What is Namespace? Namespace is a collection of names. It s a container that holds the objects and names associated to those objects. Types of Namespace and scope Built-in Namespace Module: Global Namespace Function: Local Namespace
15 Scope Rules in Python: LEGB All computer languages have scope rules LEGB rule in Python is summarized as 1. Local 2. Enclosing Built-in 3. Global 4. Built-in Global Enclosing Local
16 Local Scope Local scope is always first Global scope is searched after the local and enclose a = 5 print(a) a is declared in global scope. However, a name must be defined before it is used print(a) a = 5 NameError: name a is not defined.
17 a = 50 def func1(): global d c = 'number d = 100 def func2(): b = 55 print(a,b) func2() func1() print(d) Output: Example
18 Example a = 50 def func1(): #global d c = 'number d = 100 def func2(): b = 55 print(a,b,d) func2() func1() Print(d) Output: NameError: name 'd' is not defined
19 Enclosing Scope Functions can be nested. Search order: Local >>> Enclosing scopes >>> global scope If a name is not found in above using above order, then the built-in names are searched. Built-in names can be found as: >>> dir( builtins )
20 Quizes 1) a = 10.5 b = int(a) print(b) 10 2) x= El Paso y = Texas print(x + y) El PasoTexas print(a)? 10.5
21 3) a = 50 def func1(): func1() print(b) Output: b = 100 print(a+b) NameError: name 'b' is not defined 4) a = 50 def func1(): global b b = 100 print(a+b) func1() print(b)
22 Thank you Questions?
Chapter 4 : Informatics Practices. Data Handling. Class XI ( As per CBSE Board) Visit : python.mykvs.in for regular updates
Chapter 4 : Informatics Practices Class XI ( As per CBSE Board) Data Handling Introduction Most of the computer programming language support data type, variables,operator and expression like fundamentals.python
More informationChapter 3 : Computer Science. Class XI ( As per CBSE Board) Data Handling. Visit : python.mykvs.in for regular updates
Chapter 3 : Computer Science Class XI ( As per CBSE Board) Data Handling Introduction Most of the computer programming language support data type, variables,operator and expression like fundamentals.python
More informationData Handing in Python
Data Handing in Python As per CBSE curriculum Class 11 Chapter- 3 By- Neha Tyagi PGT (CS) KV 5 Jaipur(II Shift) Jaipur Region Introduction In this chapter we will learn data types, variables, operators
More informationIntroduction to Python (All the Basic Stuff)
Introduction to Python (All the Basic Stuff) 1 Learning Objectives Python program development Command line, IDEs, file editing Language fundamentals Types & variables Expressions I/O Control flow Functions
More informationRevision of Basics of Python
Chapter 1 : Computer Science Class XII ( As per CBSE Board) Revision of Basics of Python Introduction It is widely used general purpose,high level programming language.developed by Guido van Rossum in
More informationPYTHON PROGRAMMIN CONCEPT. Learn Python Programming
PYTHON PROGRAMMIN CONCEPT Learn Python Programming TABLE OF CONTENTS Python Tutorials About Python Programming Reasons to Learn Python Run Python in Your Computer Your First Python Program Recommended
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 information2. Distinguish between a unary, a binary and a ternary operator. Give examples of C++ operators for each one of them.
1. Why do you think C++ was not named ++C? C++ is a super set of language C. All the basic features of C are used in C++ in their original form C++ can be described as C+ some additional features. Therefore,
More informationModule 2 - Part 2 DATA TYPES AND EXPRESSIONS 1/15/19 CSE 1321 MODULE 2 1
Module 2 - Part 2 DATA TYPES AND EXPRESSIONS 1/15/19 CSE 1321 MODULE 2 1 Topics 1. Expressions 2. Operator precedence 3. Shorthand operators 4. Data/Type Conversion 1/15/19 CSE 1321 MODULE 2 2 Expressions
More informationLecture 3 Tao Wang 1
Lecture 3 Tao Wang 1 Objectives In this chapter, you will learn about: Arithmetic operations Variables and declaration statements Program input using the cin object Common programming errors C++ for Engineers
More information1. In C++, reserved words are the same as predefined identifiers. a. True
C++ Programming From Problem Analysis to Program Design 8th Edition Malik TEST BANK Full clear download (no formatting errors) at: https://testbankreal.com/download/c-programming-problem-analysis-program-design-8thedition-malik-test-bank/
More informationObjectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program
Objectives Chapter 2: Basic Elements of C++ In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationChapter 2: Basic Elements of C++
Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationChapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction
Chapter 2: Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 1 Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers
More informationHere n is a variable name. The value of that variable is 176.
UNIT II DATA, EXPRESSIONS, STATEMENTS 9 Python interpreter and interactive mode; values and types: int, float, boolean, string, and list; variables, expressions, statements, tuple assignment, precedence
More informationCSSE 120 Introduction to Software Development Practice for Test 1 paper-and-pencil part Page 1 of 6
CSSE 120 Introduction to Software Development Practice for Test 1 paper-and-pencil part Page 1 of 6 Name: Use this quiz to help you prepare for the Paper-and-Pencil portion of Test 1. Complete it electronically
More informationBasic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition
Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators JAVA Standard Edition Java - Basic Operators Java provides a rich set of operators to manipulate variables.
More informationCSC 148 Lecture 3. Dynamic Typing, Scoping, and Namespaces. Recursion
CSC 148 Lecture 3 Dynamic Typing, Scoping, and Namespaces Recursion Announcements Python Ramp Up Session Monday June 1st, 1 5pm. BA3195 This will be a more detailed introduction to the Python language
More informationWeek 2: Console I/O and Operators Arithmetic Operators. Integer Division. Arithmetic Operators. Gaddis: Chapter 3 (2.14,3.1-6,3.9-10,5.
Week 2: Console I/O and Operators Gaddis: Chapter 3 (2.14,3.1-6,3.9-10,5.1) CS 1428 Fall 2014 Jill Seaman 1 2.14 Arithmetic Operators An operator is a symbol that tells the computer to perform specific
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 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 informationCSE 111 Bio: Program Design I Lecture 4: Variables, Functions, Strings, Genbank
CSE 111 Bio: Program Design I Lecture 4: Variables, Functions, Strings, Genbank Randall Munoe, XKCD http://xkcd.com/1319/ Robert Sloan (CS) & Rachel Poretsky (Bio) University of Illinois, Chicago September
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 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 informationThe SPL Programming Language Reference Manual
The SPL Programming Language Reference Manual Leonidas Fegaras University of Texas at Arlington Arlington, TX 76019 fegaras@cse.uta.edu February 27, 2018 1 Introduction The SPL language is a Small Programming
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 informationCOMPSCI 105 S Principles of Computer Science. Classes 3
S2 2017 Principles of Computer Science Classes 3 Exercise } Exercise } Create a Student class: } The Student class should have three attributes: id, last_name, and first_name. } Create a constructor to
More information4. Inputting data or messages to a function is called passing data to the function.
Test Bank for A First Book of ANSI C 4th Edition by Bronson Link full download test bank: http://testbankcollection.com/download/test-bank-for-a-first-book-of-ansi-c-4th-edition -by-bronson/ Link full
More informationA simple interpreted language
Copyright Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See http://software-carpentry.org/license.html for more information. A simple interpreted language
More informationReserved Words and Identifiers
1 Programming in C Reserved Words and Identifiers Reserved word Word that has a specific meaning in C Ex: int, return Identifier Word used to name and refer to a data element or object manipulated by the
More informationPython Class-Lesson1 Instructor: Yao
Python Class-Lesson1 Instructor: Yao What is Python? Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined
More informationIntroduction to Programming
Introduction to Programming session 5 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2010 These slides are created using Deitel s slides Sahrif University of Technology Outlines
More informationBabu Madhav Institute of Information Technology, UTU 2015
Five years Integrated M.Sc.(IT)(Semester 5) Question Bank 060010502:Programming in Python Unit-1:Introduction To Python Q-1 Answer the following Questions in short. 1. Which operator is used for slicing?
More informationPython memento TI-Smart Grids
Python memento TI-Smart Grids Genoveva Vargas-Solar French Council of Scientific Research, LIG genoveva.vargas@imag.fr http://vargas-solar.com/data-centric-smart-everything/ * This presentation was created
More informationIntroduction to Bioinformatics
Introduction to Bioinformatics Variables, Data Types, Data Structures, Control Structures Janyl Jumadinova February 3, 2016 Data Type Data types are the basic unit of information storage. Instances of
More informationIntroduction to Programming
Introduction to Programming Python Lab 7: if Statement PythonLab7 lecture slides.ppt 14 November 2017 Ping Brennan (p.brennan@bbk.ac.uk) 1 Getting Started Create a new folder in your disk space with the
More informationProgramming in Python 3
Programming in Python 3 Programming transforms your computer from a home appliance to a power tool Al Sweigart, The invent with Python Blog Programming Introduction Write programs that solve a problem
More informationInformatics Ingeniería en Electrónica y Automática Industrial
Informatics Ingeniería en Electrónica y Automática Industrial Operators and expressions in C Operators and expressions in C Numerical expressions and operators Arithmetical operators Relational and logical
More informationCS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University
CS 112 Introduction to Computing II Wayne Snyder Department Boston University Today: Java basics: Compilation vs Interpretation Program structure Statements Values Variables Types Operators and Expressions
More informationIntroduction. Following are the types of operators: Unary requires a single operand Binary requires two operands Ternary requires three operands
Introduction Operators are the symbols which operates on value or a variable. It tells the compiler to perform certain mathematical or logical manipulations. Can be of following categories: Unary requires
More informationOnion Language Reference Manual. By: Andrew Aday, (aza2112) Amol Kapoor (ajk2227), Jonathan Zhang (jz2814)
Onion Language Reference Manual By: Andrew Aday, (aza2112) Amol Kapoor (ajk2227), Jonathan Zhang (jz2814) Introduction 3 Types 3 Lexical Conventions 4 Identifiers 4 Keywords 4 Comments 4 Expressions 5
More informationBy the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program
1 By the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program variables. Apply C++ syntax rules to declare variables, initialize
More informationComputer System and programming in C
1 Basic Data Types Integral Types Integers are stored in various sizes. They can be signed or unsigned. Example Suppose an integer is represented by a byte (8 bits). Leftmost bit is sign bit. If the sign
More informationChapter 2, Part III Arithmetic Operators and Decision Making
Chapter 2, Part III Arithmetic Operators and Decision Making C How to Program, 8/e, GE 2016 Pearson Education, Ltd. All rights reserved. 1 2016 Pearson Education, Ltd. All rights reserved. 2 2016 Pearson
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 informationPython Programming Exercises 1
Python Programming Exercises 1 Notes: throughout these exercises >>> preceeds code that should be typed directly into the Python interpreter. To get the most out of these exercises, don t just follow them
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 informationChapter 2: Overview of C++
Chapter 2: Overview of C++ Problem Solving, Abstraction, and Design using C++ 6e by Frank L. Friedman and Elliot B. Koffman C++ Background Introduced by Bjarne Stroustrup of AT&T s Bell Laboratories in
More informationCS100 Spring 2012 Midterm 1 Practice
CS100 Spring 2012 Midterm 1 Practice This practice midterm gives you a guide to the subject matter and format the first midterm of the semester. Assignment: Do the practice midterm and submit it via Moodle.
More informationby Pearson Education, Inc. All Rights Reserved. 2
1992-2010 by Pearson Education, Inc. All Rights Reserved. 2 1992-2010 by Pearson Education, Inc. All Rights Reserved. 3 1992-2010 by Pearson Education, Inc. All Rights Reserved. 4 1992-2010 by Pearson
More informationCS177 Python Programming. Recitation 2 - Computing with Numbers
CS177 Python Programming Recitation 2 - Computing with Numbers Outline Data types. Variables Math library. Range Function What is data (in the context of programming)? Values that are stored and manipulated
More informationReview: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements
Review: Exam 1 9/20/06 CS150 Introduction to Computer Science 1 1 Your First C++ Program 1 //*********************************************************** 2 // File name: hello.cpp 3 // Author: Shereen Khoja
More informationGO - OPERATORS. This tutorial will explain the arithmetic, relational, logical, bitwise, assignment and other operators one by one.
http://www.tutorialspoint.com/go/go_operators.htm GO - OPERATORS Copyright tutorialspoint.com An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations.
More informationC++ Programming: From Problem Analysis to Program Design, Third Edition
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 2: Basic Elements of C++ Objectives (continued) Become familiar with the use of increment and decrement operators Examine
More information9/10/10. Arithmetic Operators. Today. Assigning floats to ints. Arithmetic Operators & Expressions. What do you think is the output?
Arithmetic Operators Section 2.15 & 3.2 p 60-63, 81-89 1 Today Arithmetic Operators & Expressions o Computation o Precedence o Associativity o Algebra vs C++ o Exponents 2 Assigning floats to ints int
More informationProfessor: Sana Odeh Lecture 3 Python 3.1 Variables, Primitive Data Types & arithmetic operators
1 Professor: Sana Odeh odeh@courant.nyu.edu Lecture 3 Python 3.1 Variables, Primitive Data Types & arithmetic operators Review What s wrong with this line of code? print( He said Hello ) What s wrong with
More informationChapter 2: Using Data
Chapter 2: Using Data TRUE/FALSE 1. A variable can hold more than one value at a time. F PTS: 1 REF: 52 2. The legal integer values are -2 31 through 2 31-1. These are the highest and lowest values that
More informationUnit 3. Operators. School of Science and Technology INTRODUCTION
INTRODUCTION Operators Unit 3 In the previous units (unit 1 and 2) you have learned about the basics of computer programming, different data types, constants, keywords and basic structure of a C program.
More informationCS110: PROGRAMMING LANGUAGE I
CS110: PROGRAMMING LANGUAGE I Computer Science Department Lecture 4: Java Basics (II) A java Program 1-2 Class in file.java class keyword braces {, } delimit a class body main Method // indicates a comment.
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 informationBuilt-in Types of Data
Built-in Types of Data Types A data type is set of values and a set of operations defined on those values Python supports several built-in data types: int (for integers), float (for floating-point numbers),
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 informationAbout Codefrux While the current trends around the world are based on the internet, mobile and its applications, we try to make the most out of it. As for us, we are a well established IT professionals
More informationC: How to Program. Week /Mar/05
1 C: How to Program Week 2 2007/Mar/05 Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers
More informationCSC Web Programming. Introduction to JavaScript
CSC 242 - Web Programming Introduction to JavaScript JavaScript JavaScript is a client-side scripting language the code is executed by the web browser JavaScript is an embedded language it relies on its
More informationCOMP1730/COMP6730 Programming for Scientists. Data: Values, types and expressions.
COMP1730/COMP6730 Programming for Scientists Data: Values, types and expressions. Lecture outline * Data and data types. * Expressions: computing values. * Variables: remembering values. What is data?
More informationChapter 5 Conditional and Iterative Statements. Statement are the instructions given to the computer to perform any kind of action.
Chapter 5 Conditional and Iterative Statements Statement Statement are the instructions given to the computer to perform any kind of action. Types of Statement 1. Empty Statement The which does nothing.
More informationLecture 4. Defining Functions
Lecture 4 Defining Functions Academic Integrity Quiz Reading quiz about the course AI policy Go to http://www.cs.cornell.edu/courses/cs11110/ Click Academic Integrity in side bar Read and take quiz in
More informationPython 2 Conditionals and loops Matthew Egbert CS111
Python 2 Conditionals and loops Matthew Egbert CS111 Yesterday's Lecture Input and Output user_input_as_str = input('prompt: ') print('hello. You entered: '+ user_input_as_str) Comments # everything to
More informationIT 374 C# and Applications/ IT695 C# Data Structures
IT 374 C# and Applications/ IT695 C# Data Structures Module 2.1: Introduction to C# App Programming Xianrong (Shawn) Zheng Spring 2017 1 Outline Introduction Creating a Simple App String Interpolation
More informationChapter 2 Getting Started with Python
Chapter 2 Getting Started with Python Introduction Python Programming language was developed by Guido Van Rossum in February 1991. It is based on or influenced with two programming languages: 1. ABC language,
More informationFull file at C How to Program, 6/e Multiple Choice Test Bank
2.1 Introduction 2.2 A Simple Program: Printing a Line of Text 2.1 Lines beginning with let the computer know that the rest of the line is a comment. (a) /* (b) ** (c) REM (d)
More informationIntroduction to C# Applications
1 2 3 Introduction to C# Applications OBJECTIVES To write simple C# applications To write statements that input and output data to the screen. To declare and use data of various types. To write decision-making
More informationThese are reserved words of the C language. For example int, float, if, else, for, while etc.
Tokens in C Keywords These are reserved words of the C language. For example int, float, if, else, for, while etc. Identifiers An Identifier is a sequence of letters and digits, but must start with a letter.
More informationMicrosoft Visual Basic 2005: Reloaded
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 3 Variables, Constants, Methods, and Calculations Objectives After studying this chapter, you should be able to: Declare variables and named
More informationChapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers 2.4 Memory Concepts 2.5 Arithmetic
More informationData Types and Variables in C language
Data Types and Variables in C language Disclaimer The slides are prepared from various sources. The purpose of the slides is for academic use only Operators in C C supports a rich set of operators. Operators
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 informationRuby: Introduction, Basics
Ruby: Introduction, Basics Computer Science and Engineering College of Engineering The Ohio State University Lecture 4 Ruby vs Java: Similarities Imperative and object-oriented Classes and instances (ie
More informationCS 1301 CS1 with Robots Summer 2007 Exam 1
Your Name: 1 / 6 CS 1301 CS1 with Robots Summer 2007 Exam 1 1. Vocabulary Matching: (15 points) Write the number from the correct definition in the blank next to each term on the left: _12_Print statement
More informationBASIC ELEMENTS OF A COMPUTER PROGRAM
BASIC ELEMENTS OF A COMPUTER PROGRAM CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING LOGO Contents 1 Identifier 2 3 Rules for naming and declaring data variables Basic data types 4 Arithmetic operators
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 informationOliver BONHAM-CARTER. Fall 2018 Week 2
About Discrete Structures: CMPSC 102 Oliver BONHAM-CARTER Fall 2018 Week 2 1 / 24 About About www.python.org Download python3 if you are using your own hardware 1 / 24 About... About Is an interpreted,
More informationHacettepe University Computer Engineering Department. Programming in. BBM103 Introduction to Programming Lab 1 Week 4. Fall 2018
Hacettepe University Computer Engineering Department Programming in BBM103 Introduction to Programming Lab 1 Week 4 Fall 2018 Install PyCharm Download Link : https://www.jetbrains.com/pycharm-edu/download/#section=windows
More informationChapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics
Java Programming, Sixth Edition 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional Projects Additional
More informationc) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.
2.1 Introduction (No questions.) 2.2 A Simple Program: Printing a Line of Text 2.1 Which of the following must every C program have? (a) main (b) #include (c) /* (d) 2.2 Every statement in C
More informationPython The way of a program. Srinidhi H Asst Professor Dept of CSE, MSRIT
Python The way of a program Srinidhi H Asst Professor Dept of CSE, MSRIT 1 Problem Solving Problem solving means the ability to formulate problems, think creatively about solutions, and express a solution
More information1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol.
1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol. B. Outputs to the console a floating point number f1 in scientific format
More informationObjectives. In this chapter, you will:
Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates arithmetic expressions Learn about
More informationName Feb. 14, Closed Book/Closed Notes No electronic devices of any kind! 3. Do not look at anyone else s exam or let anyone else look at yours!
Name Feb. 14, 2018 CPTS 111 EXAM #1 Closed Book/Closed Notes No electronic devices of any kind! Directions: 1. Breathe in deeply, exhale slowly, and relax. 2. No hats or sunglasses may be worn during the
More informationProf. Navrati Saxena TA: Rochak Sachan
JAVA Prof. Navrati Saxena TA: Rochak Sachan Operators Operator Arithmetic Relational Logical Bitwise 1. Arithmetic Operators are used in mathematical expressions. S.N. 0 Operator Result 1. + Addition 6.
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 informationA flow chart is a graphical or symbolic representation of a process.
Q1. Define Algorithm with example? Answer:- A sequential solution of any program that written in human language, called algorithm. Algorithm is first step of the solution process, after the analysis of
More informationType Bindings. Static Type Binding
Type Bindings Two key issues in binding (or associating) a type to an identifier: How is type binding specified? When does the type binding take place? N. Meng, S. Arthur 1 Static Type Binding An explicit
More information61A Lecture 2. Friday, August 28, 2015
61A Lecture 2 Friday, August 28, 2015 Names, Assignment, and User-Defined Functions (Demo) Types of Expressions Primitive expressions: 2 add 'hello' Number or Numeral Name String Call expressions: max
More informationC Language Part 1 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee
C Language Part 1 (Minor modifications by the instructor) References C for Python Programmers, by Carl Burch, 2011. http://www.toves.org/books/cpy/ The C Programming Language. 2nd ed., Kernighan, Brian,
More informationUNIT- 3 Introduction to C++
UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage
More informationChapter 2: Introduction to C++
Chapter 2: Introduction to C++ Copyright 2010 Pearson Education, Inc. Copyright Publishing as 2010 Pearson Pearson Addison-Wesley Education, Inc. Publishing as Pearson Addison-Wesley 2.1 Parts of a C++
More informationObject Oriented Programming in Python 3
Object Oriented Programming in Python 3 Objects Python 3 Objects play a central role in the Python data model All the types we ve seen until now are in-fact objects Numeric types, strings, lists, tuples,
More informationChapter 2: Special Characters. Parts of a C++ Program. Introduction to C++ Displays output on the computer screen
Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Copyright 2009 Publishing Pearson as Pearson Education, Addison-Wesley Inc. Publishing as Pearson Addison-Wesley
More information