#Python #Top60 #BuiltInFunctions
#1.
Prints the specified message to the screen.
#2.
Returns the number of items in an object.
#3.
Returns the type of an object.
#4.
Allows user input.
#5.
Converts a value to an integer number.
---
#Python #DataTypes #Conversion
#6.
Converts a value to a string.
#7.
Converts a value to a floating-point number.
#8.
Converts a value to a Boolean (True or False).
#9.
Converts an iterable (like a tuple or string) to a list.
#10.
Converts an iterable to a tuple.
---
#Python #Math #Functions
#11.
Returns the sum of all items in an iterable.
#12.
Returns the largest item in an iterable.
#13.
Returns the smallest item in an iterable.
#14.
Returns the absolute (positive) value of a number.
#15.
Rounds a number to a specified number of decimals.
---
#Python #Iterables #Functions
#16.
Returns a sequence of numbers, starting from 0 by default, and increments by 1.
#17.
Returns a new sorted list from the items in an iterable.
#18.
Returns an enumerate object, which contains pairs of index and value.
#19.
Returns an iterator that aggregates elements from two or more iterables.
#20.
Applies a given function to each item of an iterable and returns a map object.
#1.
print()Prints the specified message to the screen.
print("Hello, World!")Hello, World!
#2.
len()Returns the number of items in an object.
my_list = [1, 2, 3, 4]
print(len(my_list))
4
#3.
type()Returns the type of an object.
name = "Python"
print(type(name))
<class 'str'>
#4.
input()Allows user input.
username = input("Enter your name: ")
print("Hello, " + username)Enter your name: Alex
Hello, Alex
#5.
int()Converts a value to an integer number.
string_number = "101"
number = int(string_number)
print(number + 9)
110
---
#Python #DataTypes #Conversion
#6.
str()Converts a value to a string.
age = 25
print("My age is " + str(age))
My age is 25
#7.
float()Converts a value to a floating-point number.
integer_value = 5
print(float(integer_value))
5.0
#8.
bool()Converts a value to a Boolean (True or False).
print(bool(1))
print(bool(0))
print(bool("Hello"))
print(bool(""))
True
False
True
False
#9.
list()Converts an iterable (like a tuple or string) to a list.
my_tuple = (1, 2, 3)
my_list = list(my_tuple)
print(my_list)
[1, 2, 3]
#10.
tuple()Converts an iterable to a tuple.
my_list = [4, 5, 6]
my_tuple = tuple(my_list)
print(my_tuple)
(4, 5, 6)
---
#Python #Math #Functions
#11.
sum()Returns the sum of all items in an iterable.
numbers = [10, 20, 30]
print(sum(numbers))
60
#12.
max()Returns the largest item in an iterable.
numbers = [5, 29, 12, 99]
print(max(numbers))
99
#13.
min()Returns the smallest item in an iterable.
numbers = [5, 29, 12, 99]
print(min(numbers))
5
#14.
abs()Returns the absolute (positive) value of a number.
negative_number = -15
print(abs(negative_number))
15
#15.
round()Rounds a number to a specified number of decimals.
pi = 3.14159
print(round(pi, 2))
3.14
---
#Python #Iterables #Functions
#16.
range()Returns a sequence of numbers, starting from 0 by default, and increments by 1.
for i in range(5):
print(i)
0
1
2
3
4
#17.
sorted()Returns a new sorted list from the items in an iterable.
unsorted_list = [3, 1, 4, 1, 5, 9]
sorted_list = sorted(unsorted_list)
print(sorted_list)
[1, 1, 3, 4, 5, 9]
#18.
enumerate()Returns an enumerate object, which contains pairs of index and value.
fruits = ['apple', 'banana', 'cherry']
for index, fruit in enumerate(fruits):
print(index, fruit)
0 apple
1 banana
2 cherry
#19.
zip()Returns an iterator that aggregates elements from two or more iterables.
names = ['Alice', 'Bob', 'Charlie']
ages = [25, 30, 35]
for name, age in zip(names, ages):
print(f"{name} is {age} years old.")
Alice is 25 years old.
Bob is 30 years old.
Charlie is 35 years old.
#20.
map()Applies a given function to each item of an iterable and returns a map object.