Tag: Python

Python Essentials | Python Basics Tutorial

In this Python tutorial, you will learn about some essentials of Python. The topics that we are going to discuss are:

  • Statements
  • Expressions
  • Multiline Statements
  • Indentation
  • Comments
  • Identifiers
  • Keywords
  • Naming Convention

Read More

Creating Relationships in Django Models

In our previous  Django Tutorial, we have discussed on Django models. Now we are going to discuss about Creating Relationships in Django Models. We are going to cover up the following topics.

1  Relationships in Django models
  • One To One (OneToOneField)
  • Many To Many (ManyToManyField)
  • One To Many (ForeignKey)
2  Data integrity options

Relationships in Django models

Django uses ORM (a library/tool)  that creates a bridge between Relational Database Tables and Python  Objects. It allows us to write Python code instead of SQL queries to run CRUD (Create, Read, Update and Delete) operations by providing a high-level abstraction upon a relational database.

Read More

Python Variables( Global, Local, Nonlocal) , Constants

Hellow Programmers, In this python tutorial I am gonna talk about variables & their types. So What is Variable?

Variable: Think about an empty pot in which you can put anything. In programming we call it variable. Actually a variable is an empty memory location to store values.

How to declare a variable in python?

Declaring a variable in python is a piece of cake. Name it & put a value into it. As python is a dynamically typed language we don’t need to declare variable types. Python is smart enough to detect the type itself.

There are some rules of declaring variables:

  • A variable name must start with a letter or the underscore character.
  • Cannot start with a number.
  • A variable name can only contain alpha-numeric characters and underscores. For example, anything like this is valid: A-z, 0–9, and _
  • Variable names are case-sensitive (height, Height, and HEIGHT are three different variables names)

Read More

Python Dictionaries – All You Need To Know

Hello geeks, in this python 3 tutorial, you are going to learn A to Z of Python dictionary. We will discuss the followings:

  • What is Python Dictionary?
  • How to create a Dictionary!
  • Add, Delete, Update Elements.
  • Access Elements of a Dictionary.
  • Merging Two Dictionaries
  • Creating Nested Dictionary
  • Adding, Deleting, Updating elements in a Nested Dictionary.
  • Different Methods of Python Dictionary.
  • copy(), fromkeys(), get(), pop(), popitem(), items(), keys(), values()

So, without further ado let’s jump into it.

What is Python Dictionary?

Python dictionary is a data type of python programming language. It stores data by mapping them with a key. Data are stored in “Key-Value” pairs where each “Key” must be unique. Lists, Tuples can also be stored as value in a dictionary.

Read More

Powered by WordPress & Theme by Anders Norén