An Interest In:
Web News this Week
- March 22, 2024
- March 21, 2024
- March 20, 2024
- March 19, 2024
- March 18, 2024
- March 17, 2024
- March 16, 2024
April 23, 2022 08:30 pm GMT
Original Link: https://dev.to/langat20/python-programming-for-beginners-pi5
Python programming for beginners
What is python?
Python is a high-level, object-oriented programming language. Most beginners in the development field prefer Python as one of the first languages to learn because of its simplicity and versatility.
Executing the Python program.
take for example we have created a file named main.py and we want to run it we will do the following
Python3 main.py
Creating Functions in Python
for example : if we want to create a function to add two variables
def add_10(x): return (10+x)
Data Types
- numbers
- strings
- boolean
- tuples
- lists
- dictionaries
control statements
- for loop
A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string).
eg.
Print each fruit in a fruit list:
fruits = ["apple", "banana", "cherry"]for x in fruits: print(x)
- if statement
If statement:
a = 33b = 200if b > a: print("b is greater than a")
Applications of Python.
Artificial Intelligence
Desktop Application
Automation
Web Development
Data Wrangling, Exploration And Visualization.
Original Link: https://dev.to/langat20/python-programming-for-beginners-pi5
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To