Sharp Tutorial
Variable in Python

Python

Java

C

C++

HTML/CSS

Java Script

PHP

SQL

C Programs

Introduction to Python

  • Introduction to Python
  • History of Python
  • How To Install Software
  • Variables in Python
  • Comments in Python
  • Input/Output
  • If else in Python
  • While Loop
  • For Loop

Collection in Python

  • Numbers in Python
  • List
  • Tuple
  • Set
  • Dictionary
  • Array
  • String

Object Oriented python

  • Function
  • Exception
  • OOPS (class/object)
  • Object Pass & Return
  • Constructor
  • Function Overloading
  • Module in Python
  • Inheritance
  • File Handling

Python With MYSQL And Excel

  • Connect MySql & Python
  • Insert Data MySQL
  • Delete/Update MySQL
  • Select Data From MySQL
  • Working With Excel in Python

Python GUI

  • GUI using Turtle
  • Introduction to Tkinter
  • Login Page using Tkinter
  • Data Grid Example Tkinter
  • Connect Multiple Forms
  • Database with GUI Python

Programs in Python

  • Swap two number
  • Calculate the area
  • Even Odd or Zero
  • Largest ,Middle and Smallest Number
  • Calculate Telephone Bill
  • Print Table of The given Number
  • Factorial of the number
  • Reverse and check number is palindrome
  • check number is prime , armstrong
  • Program to Print the given patterns
  • Guess A Number Game using Random

Variable in Python

Variable names in python can be a group of english alphabet, digits or underscore
No space or special symbol is allowed except underscore.
Variable names are case sensitive in python
First Character of the variable name can not be digit.

variables in python are declared as following.

a=10
b=”sharp tutorial”
c=5.4

Python dont need to declare the type of the variables as it automatically converts the variable based on the value.
As you see in the above example the int , float or string value is stored in the same type of the variable.

print command is used to print on the screen.

a=10
msg="welcome to sharp tutorial"
print(a)
print(msg)

  Output:
  10
  welcome to sharp tutorial

Python add two int or float numbers(int & int , int & float , float & int)
like

a=3
b=4
print(a+b)

   Output:
   7

a=4.5
b=7
print(a+b)

  Output:
  11.5

  Python concatenate two variables if both are string as following

a="sharp"
b="tutorial"
print(a+b)

  Output:
  sharp tutorial

  If we try to add number with string it gives the error

a=10
b="hello"
print(a+b)

   Output:
   TypeError: cannot concatenate ‘str’ and ‘int’ objects

   Following is the output for all above programs

Enquiry about Course

Ask your Question

Click Here

Sharp (2) Tutorials

Video/ C Introduction

Watch video in full size

Video tutorial

Follow by Email
Facebook
Facebook
fb-share-icon
YouTube
Copyright © Sharp Tutorial
Build with WordPress
Wordpress Social Share Plugin powered by Ultimatelysocial
Sharp Tutorial