Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Built-in Functions | Functions and Modules
Introduction to Data Analysis in Python
course content

Kurssisisältö

Introduction to Data Analysis in Python

Introduction to Data Analysis in Python

1. Basics
2. Data Types
3. Control Flow
4. Functions and Modules
5. Introduction to NumPy

book
Built-in Functions

Python has many useful built-in functions that can simplify some operations. For instance, these are the following:

  • min(x, y, ...) - minimum element of x, y, ...

  • max(x, y, ...) - maximum element of x, y, ...

  • abs(x) - absolute value of number x

  • round(x, n) - rounds number x to n digits

  • pow(x, n) - exponentiation (x to the power n).

For example, you may need to investigate the minimum price of certain list of prices after applying discounts. Or you may need to convert kilometers into miles without extra digits.

123456789
# List of prices with discounts prices = [400*0.7, 345*0.8, 270*0.95, 320*0.85] # The lowest price print(min(prices)) # Distance in kilometers dist = 5762.4 # Converting into miles and rounding to 2 digits print(round(dist/1.609, 2))
copy

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 4. Luku 1

Kysy tekoälyä

expand
ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

course content

Kurssisisältö

Introduction to Data Analysis in Python

Introduction to Data Analysis in Python

1. Basics
2. Data Types
3. Control Flow
4. Functions and Modules
5. Introduction to NumPy

book
Built-in Functions

Python has many useful built-in functions that can simplify some operations. For instance, these are the following:

  • min(x, y, ...) - minimum element of x, y, ...

  • max(x, y, ...) - maximum element of x, y, ...

  • abs(x) - absolute value of number x

  • round(x, n) - rounds number x to n digits

  • pow(x, n) - exponentiation (x to the power n).

For example, you may need to investigate the minimum price of certain list of prices after applying discounts. Or you may need to convert kilometers into miles without extra digits.

123456789
# List of prices with discounts prices = [400*0.7, 345*0.8, 270*0.95, 320*0.85] # The lowest price print(min(prices)) # Distance in kilometers dist = 5762.4 # Converting into miles and rounding to 2 digits print(round(dist/1.609, 2))
copy

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 4. Luku 1
Pahoittelemme, että jotain meni pieleen. Mitä tapahtui?
some-alt