Števila in izrazi Naslov teme:Spremenljivka, operator, izraz in funkcija ure: 9 in 10 Učna metoda: demonstracija, samostojno delo Učni pripomočki: Računalnik,

Slides:



Advertisements
Similar presentations
Intro to Python. Python is an interpreted language Can be used interactively Identifiers are case-sensitive Operators: + - * / ** Arbitrarily large integer.
Advertisements

A Library of Functions This presentation will review the behavior of the most common functions including their graphs and their domains and ranges. See.
Numbers. Number data types store numeric values They are immutable data types, which means that changing the value of a number data type results in a.
DEDiscover Differential Equation Modeling Solution CANGLIN WU June
Functions and methods A method is a function that is a member of a class A method is a function that is a member of a class FCL(Framework Class Library)
Functions and methods A method is a function that is a member of a class FCL(Framework Class Library) provides a rich collection of classes and methods.
Introduction to Radians (Definition, Converting Between Radians and Degrees, & When to use Degrees or Radians)
A function is a subprogram that acts on data and often returns a value. You are already familiar with the one function that every C++ program possesses:
8. Python - Numbers Number data types store numeric values. They are immutable data types, which means that changing the value of a number data type results.
EG280 - CS for Engineers Chapter 2, Introduction to C Part I Topics: Program structure Constants and variables Assignment Statements Standard input and.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
ME 142 Engineering Computation I Excel Functions.
ME 142 Engineering Computation I Excel Functions.
1 TAC2000/ Protocol Engineering and Application Research Laboratory (PEARL) MATH Functions in C Language.
Computing with Numbers Zelle - Chapter 3 Charles Severance - Textbook: Python Programming: An Introduction to Computer Science, John.
IMS 3253: Math 1 Dr. Lawrence West, MIS Dept., University of Central Florida Topics Five Fundamental Math Operations Precedence of Math.
CSC1015F – Chapter 3, Computing with Numbers Michelle Kuttel
Week 4. >>> Overview * if else * returns * input.
Python – Part 3 Functions 1. Function Calls Function – A named sequence of statements that performs a computation – Name – Sequence of statements “call”
CSE202: Lecture 4The Ohio State University1 Mathematical Functions.
Variables, Expressions, and Standard Functions. Topics Basic calculation Expressions, variables, and operator precedence Data types Input / Output Examples.
© 2012 EMC Publishing, LLC Slide 1 Chapter 7 The Math Class  Includes shared methods that perform common math functions.  Math Class methods include:
STANDARD FUNCTIONS Computer Programming Asst. Prof. Dr. Choopan Rattanapoka and Asst. Prof. Dr. Suphot Chunwiphat.
CSC Programming for Science Lecture 7: Math Functions.
Trigonometric Functions sine, cosine and tangent.
Visual Basic I Programming
Python – Part 3 Functions 1. Getting help Start the Python interpreter and type help() to start the online help utility. Or you can type help(print) to.
C++ Programming Lecture 9 Functions – Part I By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
CSCI 125 & 161 / ENGR 144 Lecture 8 Martin van Bommel.
INPUT & VARIABLES.
29 January 2016Birkbeck College, U. London1 Introduction to Programming Lecturer: Steve Maybank Department of Computer Science and Information Systems.
Header File cmath(math.h) C++. cmath Header File cmath / math functions Function name and parameters Parameters typeFunction return value acos(x)x is.
Useful Python CMSC 120: Visualizing Information. Scope def area(diameter): radius = diameter / 2.0 A = PI * radius ** 2 return A def circumference(diameter):
Recursion It is a process of calling the same function itself again and again until some condition is satisfied. Syntax: func1() { ……….. func1(); }
Review of Angles. Acute Angle – Angle less than 90 degrees Right Angle – Angle that is exactly 90 degrees.
Reviewing Trigonometry Angle Measure Quadrant Express as a function of a positive acute angle Evaluate Find the angle Mixed Problems.
Chapter 5 Trigonometric Functions Copyright © 2014, 2010, 2007 Pearson Education, Inc Trigonometric Functions of Real Numbers; Periodic Functions.
Chapter 16 Introduction to Perl Perl (Practical Extraction and Report Language) Developed by Larry Wall as a Unix scripting language. Popular server-side.
Variables, Operators, and Expressions
Simple C Programs.
Review of radian measure.
Numeric Functions Purpose:-
Some Useful MATLAB Functions
Today Variable declaration Mathematical Operators Input and Output Lab
sin x is an odd, periodic function with 2 as the least period
Functions in C ++ Subject: Programming Languages ​​for III year Topic: functions, member class.
Numeric, Cell and Structural Arrays One of the strenghts of MATLAB is the capabilty to handle collection of numbers called ARRAYS. MATLAB refers to scalars,
ECE 1304 Introduction to Electrical and Computer Engineering
Built-in MATLAB Functions Chapter 3
BIL 104E Introduction to Scientific and Engineering Computing
TMF1414 Introduction to Programming
ECE Application Programming
Chapter 1 Angles and The Trigonometric Functions
Computer Simulation Lab
Java Script.
FUNCTIONS EXAMPLES.
Fundamental of Java Programming Basics of Java Programming
Introduction to Programming
Copyright © 2017, 2013, 2009 Pearson Education, Inc.
Math Library and IO formatting
Radian Measure of a Central Angle
Section 4.1: Angles and Their Measures
Arc Length Area of a Sector Unit Circle Trig values of unit circle
class 5 retrieving a previous statement in Thonny or IDLE // %
Output Formatting Bina Ramamurthy 4/16/2019 BR.
月夜憶舍弟 戍鼓斷人行,邊秋一雁聲。 露從今夜白,月是故鄉明。 有弟皆分散,無家問死生。 寄書長不達,況乃未休兵。 杜甫
Precalculus Essentials
月夜憶舍弟 戍鼓斷人行,邊秋一雁聲。 露從今夜白,月是故鄉明。 有弟皆分散,無家問死生。 寄書長不達,況乃未休兵。 杜甫
Computer Simulation Lab
Output Formatting Bina Ramamurthy 9/25/2019 BR.
Presentation transcript:

Števila in izrazi Naslov teme:Spremenljivka, operator, izraz in funkcija ure: 9 in 10 Učna metoda: demonstracija, samostojno delo Učni pripomočki: Računalnik, projektor, priročnik, vaje Smotri: Dijak zna: Prirediti spremenljivko razume osnovne tipe podatkov Uporabi osnovne operatorje Pozna nize Uporabi knjižnice (math)

Števila in izrazi Izrazi: Primer programa: print "2 + 2 je ", 2+2 99 = 100 – 1 print "(33 + 2) / 5 + 11.5 = ",(33 + 2) / 5 + 11.5 (33 + 2) / 5 + 11.5 = 18.5 Lahko si ogledaš film

Python ima 6 osnovnih opratorjev za števila operacija znak primer potenciranje ** 5 ** 2 == 25 množenje * 2 * 3 == 6 deljenje (celoštevilčno) / 14 / 3 == 4 ostanek % 14 % 3 == 2 seštevanje + 1 + 2 == 3 odštevanje - 4 - 3 == 1 Vrstni red operatorjev: oklepaji, potence, množenje/deljenje, odštevanje, seštevanje

print "14 / 3 = ",14 / 3 14 / 3 = 4 print "14 % 3 = ",14 % 3 #ostanek pri celoštevilčnem deljenju 14 % 3 = 2 print "14.0 / 3.0 =",14.0 / 3.0 14.0 / 3.0 = 4.66666666667 print "14.0 % 3.0 =",14 % 3.0 14.0 % 3.0 = 2.0 print "14.0 / 3 =",14.0 / 3 14.0 / 3 = 4.66666666667 print "14.0 % 3 =",14.0 % 3 14.0 % 3 = 2.0 print "14 / 3.0 =",14 / 3.0 14 / 3.0 = 4.66666666667 print "14 % 3.0 =",14 % 3.0 14 % 3.0 = 2.0

Ukaz print “Prvi razred" print "1+1 =",1+1 print "2+4 =",2+4 print "5-2 =",5-2 print print “Tretji class" print "243-23 =",243-23 print "12*4 =",12*4 print "12/3 =",12/3 print "13/3 =",13/3," R ",13%3 print "Junior High" print "123.56-62.12 =",123.56-62.12 print "(4+3)*2 =",(4+3)*2 print "4+3*2 =",4+3*2 print "3**2 =",3**2 Izpis Prvi razred 1+1 = 2 2+4 = 6 5-2 = 3 Tretji class 243-23 = 220 12*4 = 48 12/3 = 4 13/3 = 4 R 1 Junior High 123.56-62.12 = 61.44 (4+3)*2 = 14 4+3*2 = 10 3**2 = 9

Vhodni podatki in spremenljivke print “Stop!" s = raw_input(“Kdo je? ") print “Lahko vstopiš,", s Ob zagonu se pojavi: Stop! Kdo je? Poldek #vneseš ime Lahko vstopiš, Poldek Oglej si film

Še nekaj primerov a = 123.4 b23 = 'Spam' ime = “Franci" b = 432 c = a + b print "a + b is", c a + b is 555.4 print “ime ti je", ime ime ti je Franci print "Sorted Parts, After Midnight or",b23 Sorted Parts, After Midnight or Spam num = input("Type in a Number: ") str = raw_input("Type in a String: ") print "num =", num print "num is a ",type(num) print "num * 2 =",num*2 print "str =", str print "str is a ",type(str) print "str * 2 =",str*2 Type in a Number: 12.34 Type in a String: Hello num = 12.34 num is a <type 'float'> num * 2 = 24.68 str = Hello str is a <type 'string'> str * 2 = HelloHello

"Hello, "+"World!" == "Hello, World!" Operacije nad nizi Operacija Znak Primer Repetition ponavljanje * "i"*5 == "iiiii" Concatenation Združevanje + "Hello, "+"World!" == "Hello, World!" Pravokotnik.py #Program izracuna povrsino in obseg pravokotnika" dolzina = input(“dolzina pravokotnika:") visina = input(“Visina pravokotnika:") print “Povrsina",visina*dolzina print “Obseg",2*dolzina+2*sirina Poglej film za rezultat

Pretvorbe stopinj temperature.py #Converts Fahrenheit to Celsius temp = input("Farenheit temperature:") print (temp-32.0)*5.0/9.0 Oglej si film

Primerjalni operatorji znak funkcija < less than manj kot <= less than or equal to Manj ali enako kot > greater than Več kot >= greater than or equal to Več ali enako kot == Equal enako != not equal različno <> another way to say not equal Različno kot zgornje

Izvajajo se spodnje zamaknjene vrstice If stavek Dvopičje Izvajajo se spodnje zamaknjene vrstice #absolutna vrednost n = input(“Stevilo? ") if n < 0: print “ABSOLUTNA VREDNOST OD",n,“JE",-n else: print " ABSOLUTNA VREDNOST OD ",n,“JE",n Zamik kot krmilni element Oglej si film

Modul MATH fabs(x) Return the absolute value of x. floor(x) Return the floor of x as a float, the largest integer value less than or equal to x. exp(x) Return e**x. log(x[, base]) Return the logarithm of x to the given base. If the base is not specified, return the natural logarithm of x (that is, the logarithm to base e). Changed in version 2.3: base argument added. log10(x) Return the base-10 logarithm of x. pow(x, y) Return x**y. sqrt(x) Return the square root of x. Trigonometric functions: acos(x) Return the arc cosine of x, in radians. asin(x) Return the arc sine of x, in radians.

atan(x) Return the arc tangent of x, in radians. cos(x) Return the cosine of x radians. hypot(x, y) Return the Euclidean norm, sqrt(x*x + y*y). This is the length of the vector from the origin to point (x, y). sin(x) Return the sine of x radians. tan(x) Return the tangent of x radians. Angular conversion: degrees(x) Converts angle x from radians to degrees. radians(x) Converts angle x from degrees to radians. Hyperbolic functions: : pi The mathematical constant pi. e The mathematical constant e.

Primeri uporabe import math pi=math.pi r=input(" polmer kroga") print"obseg kroga je",2*pi*r import math pi=math.pi r=input(" polmer kroga") print"obseg kroga je",2*pi*r print"ploscina kroga je",pi*r**2 Klik za film