Repository navigation
Expand file tree
/
Copy pathpython_intro.py
More file actions
34 lines (26 loc) · 1.46 KB
/
Copy pathpython_intro.py
File metadata and controls
34 lines (26 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Python is a high-level, interpreted, and general-purpose dynamic programming language[^1^][3].
# It was founded in 1991 by developer Guido Van Rossum[^1^][3].
# Python's design philosophy emphasizes code readability with the use of significant indentation[^2^][4].
# It is dynamically typed and garbage-collected[^2^][4].
# Python supports multiple programming paradigms:
# - Structured (particularly procedural)
# - Object-oriented
# - Functional programming[^2^][4]
# Here's an example of a simple Python program that prints "Hello, World!" to the console:
print("Hello, World!")
# Python uses indentation to define blocks of code. For example, in a function:
def greet(name):
print(f"Hello, {name}!")
greet("Alice") # prints: Hello, Alice!
# Python supports various data types like integers, floating-point numbers, strings, and booleans:
x = 10 # integer
y = 20.5 # float
z = "Hello" # string
is_active = True # boolean
# Python has powerful features for list manipulation:
numbers = [1, 2, 3, 4, 5]
numbers.append(6) # adds 6 to the end of the list
numbers.remove(1) # removes the first occurrence of 1 from the list
# Python's standard library is very extensive, offering a wide range of facilities.
# The Python Package Index (PyPI) contains numerous third-party modules that make Python capable of interacting with most of the other languages and platforms.
# Python provides constructs intended to enable clear programs on both a small and large scale[^3^][1].