EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 600+ Courses All in One Bundle
  • Login

Python 3 basics

Secondary Sidebar
Python 3 Tutorial
  • Python 3 Tutorial
    • Python 3 Commands
    • Python 3 Array
    • Python 3 Operators
    • Python 3 NumPy
    • Python 3 Webserver
    • Python 3 yield
    • Python 3 Pip
    • Python 3 Install
    • Python 3 raw_input
    • Python 3 HTTP Server
    • Python 3 Threading
    • Python 3 Requests
    • Python 3 Module Index
    • Python 3 String Format
    • Python 3 Unicode
    • Python 3 GUI
    • Python 3 xrange
    • Python 3 Tuple
    • Python 3 input
    • Python 3 JSON
    • Python 3 string
    • Python 3 try-except
    • Python 3 RegEx
    • Python 3 Object-Oriented Programming
    • Python 3 zip
    • Python 3 Exception
    • Python 3 write to file
    • Python 3 Functions
    • Python 3 List Function
    • Python 3 While Loop
    • Python 3 Global Variable
    • Python 3 String Methods
    • Python 3 interpreter
    • Python 3 REPL
    • Python 3 else if
    • Python 3 basics
    • Python 3 cheat sheet
    • Python 3 Print
    • Python 3 For Loop
    • Python 3 range
    • Python 3 Dictionary
    • Python 3 has_key
    • Python 3 URLlib
Home Software Development Software Development Tutorials Python 3 Tutorial Python 3 basics

Python 3 basics

Definition of Python 3 basics

Python 3 basics programming language that is interpreted, interactive, and object-oriented. Guido van Rossum developed it between 1985 and 1990. Python is not named after the snake Python. In 2008, Python 3.0 became available. Despite the fact that this version was designed to be backward-incompatible, many of its key features were later backported to version 2.7. Python is a very useful and important language to develop web based applications.

All in One Software Development Bundle(600+ Courses, 50+ projects)
Python TutorialC SharpJavaJavaScript
C Plus PlusSoftware TestingSQLKali Linux
Price
View Courses
600+ Online Courses | 50+ projects | 3000+ Hours | Verifiable Certificates | Lifetime Access
4.6 (86,064 ratings)

Introduction to Python 3 basics

  • Python is a sophisticated programming language that is simple to pick up. It uses high-level data structures that are efficient and an object-oriented programming methodology that is simple but effective.
  • Python is a great language for scripting and quick application development in a variety of fields and on a variety of platforms.
  • The Python interpreter and its huge standard library are freely accessible code on the website of python.

Python 3 basics

  • Below are the basic topics of python are as follows. First, we have installed python on the windows environment.

1. Python installation on windows

  • Download the latest Python 3 binaries from python.org website.
  • After downloading the installer, run the installer with admin privileges.
  • Add the path of python and start the installation process. After installation is complete then click on the close button.
  • After successful installing python 3 open the command prompt and check the version of python.

2. Check the version of python

  • We can check the version of python by using the following command. Below examples shown to check the installed version of python are as follows.

Code:

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

python --version

3. Create and run simple python program

  • We are creating a simple program and running the same by using the command prompt are as follows.

Code:

print("python 3 basics")

4. Syntax errors in python

  • When we write code in python language doesn’t allow, us to get a syntax error.
  • The below example shows syntax errors in python is as follows. By eliminating the final quote mark from the code, we can cause a syntax error.

Code:

print("python 3", basics)

5. Comment in python

  • The most popular technique to add a comment in python is to use the # character to start a new line in our code. Python ignores lines that begin with a # when it runs our code. Block comments are comments that begin on a new line. Inline comments, which show reference, are also possible.
  • The below example shows python 3 comments are as follows.

Code:

# Block comment
py_comment = "Python 3 basics"
print (py_comment) # inline comment.

6. String in python

  • Strings are made up of characters, which are individual letters or symbols. The length of a string is defined as the total number of characters in the string.

Code:

py_string = "Python 3 basics"
type (py_string)

7. Variable and data structures

  • In other programming languages, such as C, C++, and Java, we need variable types, whereas Python does not.
  • Simply type in the variable’s name, and when values are passed to it, it will recognize if the value is an int, float, char, or even a String.
  • The below example shows the variable and data structures are as follows.

Code:

py_num = 33
print (py_num)
py_num1 = 6.5
print (py_num1)
py_num ="Python 3 basics"
print (py_num)

8. Python 3 list

  • In Python, a list is the simplest fundamental data structure. A list is a changeable data structure, which means that things can be added to it after it has been created.
  • It’s like if we are going to the local market and making a list of what we want to buy, and then we may keep adding to it.
  • The below example shows python 3 lists are as follows.

Code:

py_list = [19, 27]
py_list.append (35)
py_list.append (67.5)
py_list.append ("Python")
print (py_list)

9. Input and output

  • In python, it is possible to take input from the user and display the output on the screen. The input function is used to display output from the user.

Code:

py_inp = input("Python 3 basics: ")
print ("Python 3 ", py_inp)

10. Selection

  • In python, we are making selections by using two keywords i.e. if, elif, and else. Below example shows an example of selection is as follows.

Code:

py_num = 23
if (py_num > 25):
print ("Num1")
elif (py_num > 35):
print ("Num2")
else:
print ("Num3")

11. Functions

  • Functions can be thought of as a group of code in a Python script that was intended. To define a function, Python used the term ‘def’.
  • The below example shows python 3 functions are as follows.

Code:

def py_fun ():
print ("Python 3 basics")
print ("Python 3 basics function")
py_fun ()
py_fun ()

12. Iteration or looping

  • It refers to doing something over and over again, as the name implies. Here, we’ll employ the most common ‘for’ loop.
  • In python, the loop will start with zero. In the below example, we can see that after assigning value as 11 our loop is start at 0 and ends with 10.
  • The below example shows iteration or looping in Python.

Code:

for py_loop in range (11):
print (py_loop)

13. Modules

  • Python has a large module library with a variety of functions that may be used to perform a variety of tasks. The import is a keyword that was used to include a certain module in our Python code.
  • The below example shows modules in python are as follows. We are importing a math module in our code.

Code:

import math
def Main():
py_num = -29
py_num = math.fabs (py_num)
print (py_num)
if __name__=="__main__":
Main ()

Conclusion

Python is a sophisticated programming language that is simple to pick up. It uses high-level data structures that are efficient and an object-oriented programming methodology that is simple but effective. Python 3 basics programming language that is interpreted, interactive, and object-oriented.

Recommended Articles

This is a guide to Python 3 basics. Here we discuss the Definition, introduction, Python 3 basics, examples with code implementation. You may also have a look at the following articles to learn more –

  1. Python 2 vs Python 3
  2. Python 3 vs Python 2
  3. Python 3 Cheat Sheet
  4. Binary tree in Python
Popular Course in this category
Python Certifications Training Program (40 Courses, 13+ Projects)
  40 Online Courses |  13 Hands-on Projects |  215+ Hours |  Verifiable Certificate of Completion
4.8
Price

View Course
0 Shares
Share
Tweet
Share
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Java Tutorials
  • Python Tutorials
  • All Tutorials
Certification Courses
  • All Courses
  • Software Development Course - All in One Bundle
  • Become a Python Developer
  • Java Course
  • Become a Selenium Automation Tester
  • Become an IoT Developer
  • ASP.NET Course
  • VB.NET Course
  • PHP Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Software Development Course

C# Programming, Conditional Constructs, Loops, Arrays, OOPS Concept

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

Special Offer - Python Certifications Training Program (40 Courses, 13+ Projects) Learn More