Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 23, 2022 08:30 pm GMT

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

  1. 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)
  1. 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:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To