Skip to main content

Posts

Showing posts matching the search for python

String tutorials in Python ,String-based python interview questions

A string is a collection of chars, we can store multiple characters set into String. The base Index of the String will be started from 0 to size-1 similar to LIST.but all elements of the String are connected with each other. we can write String is single quote (' '),double quote (" ") and triple quote ("""). a= 'hello'  ;  //Single Quote String a = "hello"  //Double quote String a= """hello""" //Triple quote String s = "hello" s[0]= h s[1]= e s[2]=l s[3]=l s[4]=o Example of String Program? Q1) WAP to count the total vowel and consonant in String? Solution:- s = "hello" c1=0 c2=0 for i in range(0,len(s)):     if s[i]=='a' or s[i]=='e' or s[i]=='i' or s[i]=='o' or s[i]=='u':         c1=c1+1     else:         c2=c2+1 print("total vowel is ",c1," total consonent is ",c2)      Q2)  WAP to check that String is palindrome...

Python Interview Question 2020

 Python Interview Question for freshers:- Many freshers students face problems in Python basic interview questions, now I am posting some basic interview questions of Python. 1)  What is  Python? Python is compiled or Interpreted?  Python has a machine code or Byte code? Who develops python? 2)  using python, can we create System software? 3)  Python has a data type or not?  explain the size of int, float, char, etc? 4)  What is the difference between C and Python? 5)  Python is Script-based or Code based language, explain in details? 6)  Python is an operating System dependent or Independent? 7)  Python is low level, high level or Middle-level language explain it? 8) Which operating System python script executed first? 9)  What is docstring in Python? 10)  How we can remove front-space from Python code? 11)  What is the membership and identity operator in Python? 12)  Python support typecasting or Type conversio...

Python + Django Live Interview session

Python Live Interview | TOP 20 Interview Question of Python, Django | Django + PYTHON MOCK Interview This is Python Live Interview, session We have posted this session to know the live experience of the interviewee during the interview and provide important interview questions. If any positive point you got then you can apply and if any negative point you got then you can improve in your skills. Share it on your group and Jobseeker for interview assistance. #pythonprogramming #computerscience #jobseekers #interviewquestions This Shiva Concept Solution video on "Django Interview Questions and Answers" will help you understand the 50 most asked Django Interview Questions with their best answers. It will help in preparing for your upcoming Django Developer Interviews. I am providing the LIVE Interview session, you can view all sessions and check your technical skills, you can also learn common mistakes during the interview. Interview on Core concept of Python:- Python Live ...

History & scope of Python

Python is a script based language which will be executed by the Python interpreter itself. The python script is easy to learn and a light-weight script as compare to other programming languages. A python script was developed by GUIDO VAN ROSSUM to create a device driver-based application initially. but now Python is complete technology that is used to develop System Software, Application Software , Data Science , Machine Learning , Interface Programming , Game Development, Electronic Software Implementation with IoT and Aurdino , Automation Programming for Software Testing. Python Script performance is best as compare to other languages means its performance is much better as compared to C, CPP, Java, PHP, and Another Programming language. Python script only focuses on a set of code .it not use code pattern and code structure. ........................................................................................................................................................

Python Installation

Python has an in-built IDLE that is best for python beginners. 1) PYTHON IDLE INSTALLATION Using Python .exe file Python will be installed using two different ways 1) Offline using Python IDLE 2) Online using Jupyter 1)  Offline installation using IDLE:- Step1st:- We can Install Python easily go into www.python.org and click on downloads  and download python.exe file, double click it, and install it. https://www.python.org/downloads for window 7 and before windows 7 o/s:-  Python 2.7 version should be installed. After this version, we can install Python 3: Step2nd:- Open Python IDLE ( Integrated Development Learning Environmen t) By Default IDLE Provide Terminal mode which is for instant script execution for System administrator  step3rd:- Click on File---> New File Option---> Write Python Script print("Welcome in Python Script") print("It is a script-based programming language which was created by GUIDO VAN RASSUM") step4th:- Save this file using the .py ...

Data Type in Python,What is Data Type in Python

The data type is used to provide a pattern , size, and memory allocation of data using variable, constant, and method. Python uses data type internally in the program, no need to write a data type declaration in the program because python provides flexibility to the identifier to contain multiple types of data using a  single name identifier. a=10 a= "hello" a= True Type of Data type:- Primitive Type:-  it is the primary data type of Python that is common for all programming languages. 1 int :-       a=10 2 float:-     a=12.34 3 String:-   Collection of Char's 1)  String With Double Quote:- It used to declare outer String on Python Script. s= "data"        2)  String With Single Quote:- It is used to declare inner String on Python Script. s= 'data'             3)  String With double quote three times s= """data"""    it support paragraph pattern or multilin...

Decorator in Python, What is Decorator, how to define decorator, how to call decorator, what is @ symbol in python

It is used to access the features to function in python without changes in the actual function code. the decorator will be defined using @symbol. The decorator provides extra features to the Python function. In Python script, every variable, function, and other identifier managed by Object. hence function contains a unique address using function name. It is used to modify the functionality of the function without modification of the actual function code. Now I am creating two different programs to explain decorators in Python:- Example 1:- def displaypricegst(func):     def func(p):         print("Price with GST",p+p*0.20)     return func       @displaypricegst def displayPrice(price):     print("Actual price",price) displayPrice(100)     Example2:- def funnew(func):        #this will contain new features and old features both     print("world")     return func ...

Python Introduction:-

Python is a high-level script-based language that contains the only interpreter to execute a python script. Script-based language means the language that will be executed by the  Interpreter. The interpreter will execute  the code line by lin e, Script-based language does not contain any separate compiler to convert the code. the compiler will be in-built under the interpreter. PHP,  PYTHON,  RUBY,  JS,  JQUERY,  ANGULAR,  NODE,  REACT all are script-based languages. Initially, a Python script was developed to create a device driver-based software system for the different operating systems. But now  Python is complete technology or platform which contain multiple library , framework, and support to create application softwar e. using Python script We can create the following application. 1 Desktop Application:-    This type of application will be installed separately on each machine. without using the internet this type ...

How to Connect Database in Django | Django Database operation

To manage database operation in Django  First We create a Database using SQLITE, It will be by default exists under the Django project. SQLite is a lite weight database software which is the RDBMS (Relational database management system)  light-weight package which is mostly used in mobile applications but now it can be used in the web application, enterprise application, etc. Django provides ORM (Object Relational Mapping) tools that are used to map the database table of SQLite in an application using objects. ORM means Object-relational mapping that provides a set of classes to implement a set of tables. Step's for database Operation using DJANGO 1)  Create an app using python manage.py startapp app-name 2)  Create Classes under models.py  file according to a database table  schema for example if we want to create a registration form using four different fields username, password, email, and mobileno then we create Register clas...

Variable,Constant and Literals Declaration in Python

Variable :-   it is an identifier that is used to contain values in the program. variable value and type can be changed in the program at run time. Python variable datatype will be managed by the assigned value . Python variable type and memory allocation depend on assigned data .we can provide multiple data types for a single variable in the python program. Python variable is a loosely coupled type declaration so that we can change variable datatype in the program. The syntax for Variable Declaration in Python:- identifier=value  #single value  identifier1,identifier2,...= value1,value2,..   #multiple variable, multiple value a=10 a,b,c = 10,20,30 a,b=10,20 print(a+b) Example of variable:- a,b = input("enter first number"),input("enter second number") print(a+b)   #  "10"+"20"  "1020" print(int(a)+int(b))  # 10+20 print(int(a+b))    #  1020  int print(int(a)+float(b))   

Operator Tutorials in Python, What is Operator in Python, Type of Operator in Python

Operator Concept in Python It is used to perform an operation using operand. the operand can be variable, constant, or literals . The operator is defined as a predefined function in the python class library and it will be called by the symbol. python has __add__() for addition which will be called + symbol Type of operator 1 Arithmetic Operator:-   This operator is used to perform the mathematical operations in the Python program. +  (addition) and String Concatenation   10+20 (30)  "10"+"20" (1020) 10+20.0 (30.0)  -  (Subtraction) * (Multiplication)  / ( true division )      5/2(2.5)  // (floor division)    5//2 (2 ignore fractional part and provide least integer part)  ** (power)           %  ( remainder)     5%10 (5)   10%3 (1) Example of True Division and Floor Division:- a=10 #b= a/3   # True division b = a//3  # floor Divisio...

Exception handling Concept in Python:-

Exception handling Concept in Python:- Exception means unexpected run time error, which will be occurred during the execution of the program. It is used to handle unexpected run time errors of the program to solve another program code interruption. A project is a set of programs, if one program will be interrupted then the complete project will be destroyed hence we should always implement exception handling to protect program interruption in an application. Python provides  a try-except block to manage the exception block in the python program. try block is used to represent code and except block will be used to write error message. Exception handling is mandatory in all program codes hence we should always exception handling under python script. Some Exceptions can be raised by hardware issues, software issues, network issues, permission issues, disk failures. Basic Syntax of Exception on Python:- 1)   Only Try and Except:- try:    CODE BLOCK    ...