Category python3-tutorial

Python 3 Date and Time

Python 3 Dates and Times Python programs can manipulate dates and times in many ways, and converting date formats is a common function. Python provides a time and calendar modules for formatting dates and times. Time intervals are expressed as…

Python 3 strings

Python 3 Strings Strings are the most commonly used data type in Python. We can use quotation marks (‘ or “) to create strings. Creating a string is simple: just assign a value to a variable. For example: var1 =…

Python 3 Tutorial

Python 3 Tutorial Python 3.0 is often referred to as Python 3000, or simply Py3k. Compared to earlier versions of Python, this is a significant upgrade. To avoid excessive portability, Python 3.0 was designed without backward compatibility. We’ve already covered…

Python 3 operators

Python 3 Operators What are Operators? This chapter explains Python operators. Let’s take a simple example: 4 + 5 = 9. In this example, 4 and 5 are called operands, and “+” is called the operator. The Python language supports…

Python 3 basic syntax

Python 3 Basic Syntax Encoding By default, Python 3 source code files are encoded in UTF-8, and all strings are Unicode. Of course, you can also specify a different encoding for your source code files: # -*- coding: cp-1252 -*-…

Python 3 input and output

Python 3 Input and Output In the previous chapters, we’ve already touched upon the input and output capabilities of Python. This chapter will cover Python’s input and output in detail. Output Formatting Python has two ways to output values: using…

Python 3 Dictionary

Python 3 Dictionary A dictionary is another mutable container model that can store objects of any type. Each key=>value pair in a dictionary is separated by a colon (:), and each pair is separated by a comma (,). The entire…

Overview of the Python 3 Standard Library

Python 3 Standard Library Overview Operating System Interface The os module provides a number of operating system-related functions. >>> import os >>> os.getcwd() # Returns the current working directory 'C:Python34' >>> os.chdir('/server/accesslogs') # Changes the current working directory >>> os.system('mkdir…

Python 3 Programming First Steps

First Steps in Python 3 Programming In the previous tutorial, we’ve learned some basic Python 3 syntax. Now, let’s try writing a Fibonacci sequence. Example (Python 3.0+) #!/usr/bin/python3 # Fibonacci series: Fibonacci numbers # The sum of two elements determines…