Python | Algorithms | Data Structures | Cyber ​​Security | Networks
38.6K subscribers
777 photos
23 videos
21 files
711 links
This channel is for Programmers, Coders, Software Engineers.

1) Python
2) django
3) python frameworks
4) Data Structures
5) Algorithms
6) DSA

Admin: @Hussein_Sheikho

Ad & Earn money form your channel:
https://telega.io/?r=nikapsOH
Download Telegram
#Python #Top60 #BuiltInFunctions
👇👇👇👇👇
Please open Telegram to view this post
VIEW IN TELEGRAM
#Python #Top60 #BuiltInFunctions

#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.