Python 3 Tutorial : Basics Syntax in Python 3

Python 3 Tutorial for beginners : how to learn Basics Syntax in Python 3, Comments in Python,Quotation in Python,Multi-Line Statements,Lines and Indentation in Python 3 for beginners

Python 3 tutorial - in Python 3 or python 2, we has many similarities to C, and Java programming languages.

At the previews lessons, we have learn about python 3, please read
  1. How to install python tools for visual studio
  2. How to create "Hello World" program using python 3
in this lessons, we will Explain about Basics Syntax that can use in Python 3.

Start writing Code

As we know, to print simple string with python 3, just following this script

print ("Hello World!")

When you execute that file (helloworld.py) on your command or debugging from visual studio, you will get this result :

Hello World!

Lines and Indentation

To indicate an blocks of a code in the class in python 3, that doesn't use an braces({}). For this point, python 3 not same with other programming language, see code line below.

if True:
    print ("It's True statement")
else:
    print ("It's False statement")

Multi-Line Statements

Multi line Statements in Python 3  typically end with a new line. Python does, however, allow the use of the line continuation character (\) to denote that the line should continue.

Python 3 Tutorial : Basics Syntax in Python 3

data  = variable1 + \
        variable2 + \
        variable3

or, more example we can try use array in python 3

days  = ['Monday', 'Tuesday', 'Wednesday',
        'Thursday', 'Friday']

Quotation in Python

Python 3 programming language accepts single ('), double (") and triple (''' or """) quotes to denote string literals, as long as the same type of quote starts and ends the string.

just following this python simple code below :

word      = 'word'
sentence  = "This is a sentence."
paragraph = """This is a paragraph. It is
            made up of multiple lines and sentences."""

Comments in Python

To add comment in python 3 programming languages A hash sign (#) that is not inside a string literal begins a comment. All characters after the # and up to the end of the physical line are part of the comment and the Python interpreter ignores them.

#!/usr/bin/python3
# First comment
print ("Hello World!") # next comment
print ('let me introduce myself') # this, comment too,
# this comment to print ("My name is Harison, I work at an Private Company in Indonesia.")
print ("'CV.Delta Microtech' as a .Net Programmer since 2010.")
print ("Please Subscribe and Follow Our Social Medias 'Sector Code' to get Latest tutorials and will be send to your email everyday for free!,")
print ('Nice to meet you and Happy coding :) all ^^')

Multiple Statements on a Single Line

in python 3 programming language, The semicolon ( ; ) will allows for multiple statements on the single line given that neither statement starts a new code block. Here is a sample snip using the semicolon :

import sys; a = 'string'; sys.stdout.write(a + '\n')

Multiple Statement Groups as Suites

A group of individual statements, which make a single code block are called suites in Python. Compound or complex statements, such as if, while, def, and class require a header line and a suite.

Header lines begin the statement (with the keyword) and terminate with a colon ( : ) and are followed by one or more lines which make up the suite. For example, following this python code :

if expression : 
   suite
elif expression : 
   suite 
else : 
   suite

See you next Lessons..

COMMENTS

Next Recomended


Feel free to code it up and send us a pull request.

Hi everyone, let's me know how much this lesson can help your work. Please Subscribe and Follow Our Social Media 'kodeajaib[dot]com' to get Latest tutorials and will be send to your email everyday for free!, Just hit a comment if you have confused. Nice to meet you and Happy coding :) all ^^



Follow by E-Mail


Name

ADO.NET,3,Ajax,6,Android,9,AngularJS,4,ASP.NET,4,Blogger Tutorials,7,Bootstrap,7,C++,1,Codeigniter,2,Cplusplus,6,Crystal Report,6,CSharp,25,Ebook Java,2,FlyExam,1,FSharp,3,Game Development,2,Java,35,JDBC,2,Laravel,84,Lumen,2,MariaDB,2,Ms Access,3,MySQL,31,ODBC,6,OleDB,1,PHP,14,PHP Framework,5,PHP MYSQLI,9,PHP OOP,5,Python,8,Python 3,4,SQL Server,4,SQLite,4,Uncategorized,5,Vb 6,2,Vb.Net,89,Video,48,Vue Js,4,WPF,2,Yii,3,
ltr
item
KODE AJAIB: Python 3 Tutorial : Basics Syntax in Python 3
Python 3 Tutorial : Basics Syntax in Python 3
Python 3 Tutorial for beginners : how to learn Basics Syntax in Python 3, Comments in Python,Quotation in Python,Multi-Line Statements,Lines and Indentation in Python 3 for beginners
https://1.bp.blogspot.com/-yAZGB9sbbAA/V-o59-ZUEfI/AAAAAAAACkc/r5EUpiWSxysALlApsGDj2TCqFPDYQKWQACLcB/s320/python-3-tutorial-for-beginner.png
https://1.bp.blogspot.com/-yAZGB9sbbAA/V-o59-ZUEfI/AAAAAAAACkc/r5EUpiWSxysALlApsGDj2TCqFPDYQKWQACLcB/s72-c/python-3-tutorial-for-beginner.png
KODE AJAIB
https://www.kodeajaib.com/2016/09/python-3-tutorial-basics-syntax-python.html
https://www.kodeajaib.com/
https://www.kodeajaib.com/
https://www.kodeajaib.com/2016/09/python-3-tutorial-basics-syntax-python.html
true
3214704946184383982
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy