Python. Olmo Zavala R. Python Exercises. Center of Atmospheric Sciences, UNAM. August 24, 2016

Similar documents
Built-in Types of Data

(IUCAA, Pune) kaustubh[at]iucaa[dot]ernet[dot]in.

(IUCAA, Pune) kaustubh[at]iucaa[dot]ernet[dot]in 1 of 29 Thursday 16 October :50 PM

Programming for Engineers in Python. Recitation 2

DM536 / DM550 Part 1 Introduction to Programming. Peter Schneider-Kamp.

Mentor Graphics Predefined Packages

PyCUDA. Continued...

Programming for Engineers in Python. Recitation 3 Functions

Programming for Engineers in Python. Recitation 3

Object-Based Programming. Programming with Objects

Programming in C. Part 1: Introduction

Chap 6 Function Define a function, which can reuse a piece of code, just with a few different values.

Lab 7: Reading Files, Importing, Bigram Function. Ling 1330/2330: Computational Linguistics Na-Rae Han

Arithmetic and Logic Blocks

Introduction to Programming and 4Algorithms Abstract Types. Uwe R. Zimmer - The Australian National University

High Level Scripting. Gino Tosti University & INFN Perugia. 06/09/2010 SciNeGhe Data Analysis Tutorial

A. Matrix-wise and element-wise operations

Matlab Workshop I. Niloufer Mackey and Lixin Shen

DM550/DM857 Introduction to Programming. Peter Schneider-Kamp

SECOND EDITION SAMPLE CHAPTER. First edition by Daryl K. Harms Kenneth M. McDonald. Naomi R. Ceder MANNING

Computing Fundamentals

Essentials for Scientific Computing: Introduction to Python Day 11 & 12

IVOA Astronomical Data Query Language Version 0.6

2.0. C/C++ Compiler and Library. Manual for ADSP-21xxx DSPs. Third Revision, September, Part Number

Working with Sequences: Section 8.1 and 8.2. Bonita Sharif

Computational Physics

Blair, Steven Macpherson (2015) Beckhoff and TwinCAT 3 System Development Guide. [Report], Strathprints

ADSP-2100 Family. C Runtime Library Manual

Computer Science 121. Scientific Computing Winter 2016 Chapter 3 Simple Types: Numbers, Text, Booleans

Function Example. Function Definition. C Programming. Syntax. A small program(subroutine) that performs a particular task. Modular programming design

SAMPLE CHAPTER. Naomi Ceder MANNING. Foreword by Nicholas Tollervey

6-1 (Function). (Function) !*+!"#!, Function Description Example. natural logarithm of x (base e) rounds x to smallest integer not less than x

Introduction to Python for Plone developers

CUDA Toolkit 5.0 Performance Report. January 2013

7. String Methods. Methods. Methods. Data + Functions Together. Designing count as a Function. Three String Methods 1/22/2016

Basic types and definitions. Chapter 3 of Thompson

Python Tutorial. Day 1

Variables. location where in memory is the information stored type what sort of information is stored in that memory

Script started on Thu 25 Aug :00:40 PM CDT

CS3157: Advanced Programming. Outline

Single row numeric functions

INTRODUCTION TO C++ FUNCTIONS. Dept. of Electronic Engineering, NCHU. Original slides are from

tag 220 tan[f l] struct { int i; double d; } sa, sb; struct { int i; double d; } s1, s2;

CUDA Toolkit 4.0 Performance Report. June, 2011

Computing and Statistical Data Analysis Lecture 3

1001ICT Introduction To Programming Lecture Notes

Introduction to Programming

The following sections describe how to implement floating point operations using either the Spin Language or assembler code.

Module 01: Introduction to Programming in Python

FF-900 FS 6.0 Fieldbus Specification Device Description Language

How to Design Programs Languages

7. String Methods. Topics: Methods and Data More on Strings Functions and Methods The String Class

CISC 1110 (CIS 1.5) Introduc2on to Programming Using C++

Introduction to GPGPUs and to CUDA programming model: CUDA Libraries

Numerical Modelling in Fortran: day 2. Paul Tackley, 2017

Module 3: Strings and Input/Output

Introduction to MATLAB

String Processing CS 1111 Introduction to Programming Fall 2018

,$5(0%(''(':25.%(1&+ $16,&'(9(/230(17722/6 EMBEDDED WORKBENCH ANSI C COMPILER C-SPY FOR NATIONAL SEMICONDUCTOR CORP. S &RPSDFW5,6& 70 &5

Strings. Upsorn Praphamontripong. Note: for reference when we practice loop. We ll discuss Strings in detail after Spring break

cs3157: another C lecture (mon-21-feb-2005) C pre-processor (3).

Chapter 2 Introduction to Jython

Computer Programming 5th Week loops (do-while, for), Arrays, array operations, C libraries

LAB 7 FUNCTION PART 2

Ebooks Chemical Engineering

ECET 264 C Programming Language with Applications

Introduction to MATLAB

Excel R Tips. is used for multiplication. + is used for addition. is used for subtraction. / is used for division

Highly Optimized Mathematical Functions for the Itanium Processor

Macro Programming Reference Guide. Copyright 2005 Scott Martinez

Using Free Functions

C++, How to Program. Spring 2016 CISC1600 Yanjun Li 1

Introduction to C Language

PIV Programming. Today s Contents: 1. Matlab Programming 2. An example of PIV in Matlab code 3. EDPIV 4. PIV plugin for ImageJ 5.

Engineering Problem Solving with C++, 3e Chapter 2 Test Bank

Chapter 8: More About Strings. COSC 1436, Summer 2018 Dr. Zhang 7/10/2018

A General Introduction to Matlab

MYSQL NUMERIC FUNCTIONS

Basics of ST. Each must end with a semi-colon (";") Basic statement. Q:=IN; Q:=sin(angle); Q := (IN1 + (IN2 / IN 3)) * IN4;

1 class Lecture5 { 2 3 "Methods" / References 8 [1] Ch. 5 in YDL 9 [1] Ch. 20 in YDL 0 / Zheng-Liang Lu Java Programming 176 / 199

COMP 364: Classes, Objects, and Names

Assoc. Prof. Dr. Tansu FİLİK

Dr Richard Greenaway

Data Parallel Execution Model

LAB 1 General MATLAB Information 1

Chapter 3 Mathematical Functions, Strings, and Objects

Chapter 1 Getting Started Structured Programming 1

The Cygnus C Math Library

S III. Case Study: TI Calculator Numerics

The Red Hat newlib C Math Library

The Red Hat newlib C Math Library

Scientific Functions Complex Numbers

JUN / 04 VERSION 7.0

Macro B Reference Guide

UNIT-III. All expressions involving relational and logical operators will evaluate to either true or false

Introduction to Scientific and Engineering Computing, BIL108E. Karaman

(5) ifit/math: «One Class to do some Math» God damn it! Just compute it! ifit workshop NBI Jan 2012 Math - 1

1. Match each of the following data types with literal constants of that data type. A data type can be used more than once. A.

Statistical Data Analysis: Python Tutorial

MATLAB Workshop Dr. M. T. Mustafa Department of Mathematical Sciences. Introductory remarks

Transcription:

Exercises Center of Atmospheric Sciences, UNAM August 24, 2016

NAND Make function that computes the NAND. It should receive two booleans and return one more boolean. logical operators A and B, A or B, not(a)

XOR Make function that computes the Exclusive or. It should receive two booleans and return one more boolean. logical operators A and B, A or B, not(a)

Three inputs Make function that computes A or (B and C). It should receive three booleans and return one more boolean. logical operators A and B, A or B, not(a)

Math packages 1 A function that receives a list and computes the factorial number of each value inside the list. The function should return a list with all the factorial numbers. How to import the package: import math acos (x) asin (x) atan (x) atan2 (x, y) ceil (x) cos (x) cosh (x) exp (x) fabs (x) floor (x) fmod (x, y) frexp (x) ldexp (x, y) log (x) log10 (x) modf (x) pow (x, y) sin (x) sinh (x) sqrt (x) tan (x) tanh (x) ATTRIBUTES math.pi pi e

Math packages 1 A function that receives a list and computes the factorial number of each value inside the list. The function should return a list with all the factorial numbers. 2 A function that receives the radius of a circle and returns the area of a circle. How to import the package: import math acos (x) asin (x) atan (x) atan2 (x, y) ceil (x) cos (x) cosh (x) exp (x) fabs (x) floor (x) fmod (x, y) frexp (x) ldexp (x, y) log (x) log10 (x) modf (x) pow (x, y) sin (x) sinh (x) sqrt (x) tan (x) tanh (x) ATTRIBUTES math.pi pi e

Math packages 1 A function that receives a list and computes the factorial number of each value inside the list. The function should return a list with all the factorial numbers. 2 A function that receives the radius of a circle and returns the area of a circle. 3 A function that receives the radius of a circle and returns the volume of a sphere. How to import the package: import math acos (x) asin (x) atan (x) atan2 (x, y) ceil (x) cos (x) cosh (x) exp (x) fabs (x) floor (x) fmod (x, y) frexp (x) ldexp (x, y) log (x) log10 (x) modf (x) pow (x, y) sin (x) sinh (x) sqrt (x) tan (x) tanh (x) ATTRIBUTES math.pi pi e

Math packages 1 A function that receives a list and computes the factorial number of each value inside the list. The function should return a list with all the factorial numbers. 2 A function that receives the radius of a circle and returns the area of a circle. 3 A function that receives the radius of a circle and returns the volume of a sphere. 4 A function that receives a list of numbers and computes the sine for each of them. How to import the package: import math acos (x) asin (x) atan (x) atan2 (x, y) ceil (x) cos (x) cosh (x) exp (x) fabs (x) floor (x) fmod (x, y) frexp (x) ldexp (x, y) log (x) log10 (x) modf (x) pow (x, y) sin (x) sinh (x) sqrt (x) tan (x) tanh (x) ATTRIBUTES math.pi pi e

Functions of a string https://docs.python.org/3/library/stdtypes.html#str.split 1 A function that receives a string and returns a string with all upper case letters. How to use the functions: mys = sopas perico mys.upper() index isalnum isdecimal islower isupper lower replace swapcase split isalpha isdigit isnumeric join lstrip strip upper

Functions of a string https://docs.python.org/3/library/stdtypes.html#str.split 1 A function that receives a string and returns a string with all upper case letters. 2 A function that receives a string with words separated by, and returns a list with each word in a cel. How to use the functions: mys = sopas perico mys.upper() index isalnum isdecimal islower isupper lower replace swapcase split isalpha isdigit isnumeric join lstrip strip upper

Functions of a string https://docs.python.org/3/library/stdtypes.html#str.split 1 A function that receives a string and returns a string with all upper case letters. 2 A function that receives a string with words separated by, and returns a list with each word in a cel. 3 A function that receives a string with words and numbers separated by, and returns a list with all the numbers in that list of words. How to use the functions: mys = sopas perico mys.upper() index isalnum isdecimal islower isupper lower replace swapcase split isalpha isdigit isnumeric join lstrip strip upper