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 Pyt…


This content originally appeared on DEV Community and was authored by Kipkurui Evans Langat

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 = 33
b = 200
if b > a:
  print("b is greater than a")

Applications of Python.

Artificial Intelligence
Desktop Application
Automation
Web Development
Data Wrangling, Exploration And Visualization.


This content originally appeared on DEV Community and was authored by Kipkurui Evans Langat


Print Share Comment Cite Upload Translate Updates
APA

Kipkurui Evans Langat | Sciencx (2022-04-23T20:30:02+00:00) Python programming for beginners. Retrieved from https://www.scien.cx/2022/04/23/python-programming-for-beginners/

MLA
" » Python programming for beginners." Kipkurui Evans Langat | Sciencx - Saturday April 23, 2022, https://www.scien.cx/2022/04/23/python-programming-for-beginners/
HARVARD
Kipkurui Evans Langat | Sciencx Saturday April 23, 2022 » Python programming for beginners., viewed ,<https://www.scien.cx/2022/04/23/python-programming-for-beginners/>
VANCOUVER
Kipkurui Evans Langat | Sciencx - » Python programming for beginners. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/04/23/python-programming-for-beginners/
CHICAGO
" » Python programming for beginners." Kipkurui Evans Langat | Sciencx - Accessed . https://www.scien.cx/2022/04/23/python-programming-for-beginners/
IEEE
" » Python programming for beginners." Kipkurui Evans Langat | Sciencx [Online]. Available: https://www.scien.cx/2022/04/23/python-programming-for-beginners/. [Accessed: ]
rf:citation
» Python programming for beginners | Kipkurui Evans Langat | Sciencx | https://www.scien.cx/2022/04/23/python-programming-for-beginners/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.