Skip to main content

Posts

Showing posts from September, 2023

Python Concatenating two Tuples and using sum function- max() and min() functions

 #Concatenating two Tuples: tup1 = (1, 2, 7,3, 4, 5) tup2 = (3, 4, 5, 6, 7) # concatenate tuples using + operator tup3 = tup1 + tup2 print(tup3) output: (1, 2, 7, 3, 4, 5, 3, 4, 5, 6, 7) sum() function We can also use the Python built-in function sum to concatenate two tuples. tup1 = (1, 2, 7,3, 4, 5) tup2 = (3, 4, 5, 6, 7) tup3=sum((tup1,tup2),()) print(tup3) #(1, 2, 7, 3, 4, 5, 3, 4, 5, 6, 7) #nested uples nestedtuple = ((20, 40, 60), (10, 30, 50), "Python") print(nestedtuple[2][0])   for i in nestedtuple:     print("tuple", i, "elements")     for j in i:         print(j, end=", ")     print("\n") output: P tuple (20, 40, 60) elements 20, 40, 60,  tuple (10, 30, 50) elements 10, 30, 50,  tuple Python elements P, y, t, h, o, n,  #built-in functions with tuple min() and max(): tup1 = ('xyz', 'zara', 'abc') print(max(tup1))   print(min(tup1)) tup2 = (11, 22, 10, 4) print(max(tup2)) print(min(tup2)) ...

Software and hardware jobs in guntur (Python, Java,Digital Marketing)

Software and hardware jobs in guntur (Python, Java,Digital Marketing) Company name : MBIT Training and Placement  Experience : Freshers  Our Technologies : Python,Java,digital Marketing Job Role : write simple code and get rid of bugs in software. Attending Meetings. Developeing Applications Qualification : Any Degree(Bsc,Btech,Mtech,Mca) Address : Arundelpet 5/4 Guntur Amaravathi Contact Numbers :  9700600572,7799596277 #jobs in guntur, #software jobs in guntur, #python jobs in guntur, #java jobs in guntur, #digital marketing jobs in guntur, #training and placement guntur, #private jobs in guntur

Multiple job Vacancies in Private Limited Company - Contact more details

Multiple job Vacancies in Private Limited Company   TLK pvt ltd Multiple job Vacancies Qualification :  10th inter and Degree Salary : 18000 to 25000 Age : 18 to 45 Contact Number : 7207833091

Adding and changing elements in a tuple using insert() and append methods

  Adding and changing elements in a tuple using insert and append: A list is a mutable type, which means we can add or modify values in it, but tuples are immutable, so they cannot be changed. #how to add new element in tuple object using index based tup=(6,75,66,34,23) print(tup) #print all tuple elements newlist=list(tup) #tuple to list convert newlist.insert(2,40) #add new element in list tup=tuple(newlist) #convert list to tuple print(tup) #print all elements in tuple output: (6, 75, 66, 34, 23) (6, 75, 40, 66, 34, 23) #how to add new element in tuple object using apped() method tup=(6,75,66,34,23) newlist=list(tup) newlist.append(22) tup=tuple(newlist) print(tup) output: (6, 75, 66, 34, 23, 22) #Modify nested items of a tuple: then we can change its values in the case of a nested tuple. Ex: tuple1 = (10, 20, [25, 75, 85]) print(tuple1) tuple1[2][0] = 250 print(tuple1) output: (10,20,[250,75,85])      #python tuples, #python training in guntur, #python jobs in gu...

Reputed Hospital Required the following Multiple Vacancies - Piduguralla,Narasaraopet,Macherla,Vinukonda

Reputed Hospital Required the following Vacancies DMO(Duty Doctor)-2 Pharmacist-5 Nursing Superintendent-2 Receptionist-3 Marketing Manager-1 Op co-ordinator-1 Driver-2 Lab Technician-2 Security-5 House Keeping-5 Social Media Content Creator-1 Physiotherapist-2 Cooks-2 Contact Details: Dr Anji Reddy Supere Speciality Hospital 8897796918,9703813777 Jobs Locations : Piduguralla,Narasaraopet,Macherla,Vinukonda

Python tuple positive indexing or forward indexing and native indexing or backward indexing

Python tuple positive indexing or forward indexing  and native indexing or  backward indexing  Positive index      0      1        2       3        4       5                                     90     50     30     20     99    10 Native index        -6      -5      -4      -3      -2      -1  #accessing elements in python tuple indexing number and slicing #python tuple positive indexing or forward indexing stat with 0 end with n-1 tuple=(40,70,12,23,78,"ram",45.77,78) print(tuple)           #print all elements in tuple print(tuple[3])      #print 3rd index el...

Python tuple packing and unpacking - Python coding

Python tuple packing and unpacking python tuple can also be created without using a tuple() class or enclosing the items inside the parentheses. it is called the variable packing #python tuple packing into tuple tuple=23,44,66,'django' print(tuple) print(type(tuple)) #unpacking tuple into variable a,b,c,d=tuple print("a is =",a) print("b is =",b) print("c is =",c) print("d is =",d) print(type(a)) print(type(b)) print(type(c)) print(type(d)) output :  (23, 44, 66, 'django') <class 'tuple'> a is = 23 b is = 44 c is = 66 d is = django <class 'int'> <class 'int'> <class 'int'> <class 'str'>

Python tuples - tuple datatype in python

Python tuples - tuple datatype in python   python tuples are ordered it can store variables of all types that are unchangeable creating tuple in two ways using parenthesis() A tuple is created by enclosing comma separated elements inside rounded brackets. python tuple characteristics:     Ordered : tuples are part of sequence data types     Unchangeable : tuple are unchangeble, we cannot add or delete element     Heterogeneous : means different datatypes Create a tuple using the two ways: #Using parenthesis () tuple=(56,77,88,78,23) print(tuple) print(type(tuple)) output : (56,77,88,78,23) #Using a tuple() constructor x=tuple((56,88,99,34.77,83)) print(x) print(type(x)) output: ((56,88,99,34.77,83)) #Heterogeneous  type tuple elements and nested tuple sampletuple = ('ram',44,45.65,[23,25, 78]) print(sampletuple) output:  ('ram',44,45.65,[23,25, 78])

Concatenation of two lists elements - list extend and copy methods

 #Concatenation of two lists elements mylist1=[34,55,66,77,'krishna'] mylist2=[56,77,33,44] mylist3=mylist1+mylist2 print(mylist3) output: [34, 55, 66, 77, 'krishna', 56, 77, 33, 44] #using extend method mylist1.extend(mylist2) # adding second list to first list print(mylist1)  outpput: [34, 55, 66, 77, 'krishna', 56, 77, 33, 44]                #copy one list to another list useing copy() method mylist=[45,66,33,44,77] newlist=mylist.copy() # copy list elemetns mylist to newlist print(newlist) output: [45, 66, 33, 44, 77] #python training, #python jobs in guntur, #python training in hyderabad

Python Developer jobs in Guntur - 1 to 4 years experience in AWS/Python Developer

 1 to 4 years experience in AWS/Python Developer Experience with Cloud Platforms,Cloud services, Python etc., Strong programming experience with Python  Experience in Linux Configuration Management Configuration management experience Build or Contiguous Integration Excellent working knowledge of Jenkins or other CI tools Ability to use GIT Container Orchestration Container technologies, Docker, Virtualization, VMware Experience with test automation Excellent written communication, problem solving, and process management skills UNIX/Linux experience, Jenkins and CICD job Responsibilities: Candidate will work very closely with the engineering teams to increase engineering efficiency through automation and CICD. This job involves actual implementation of solutions, deployments, functionality, performance, security and operational scalability including administrative tasks. This is an excellent opportunity to learn about machine learning as a key member of our world-class team. Ro...

How to Adding and changing items in a Tuple-Modify nested items of a tuple:

  #how to Adding and changing items in a Tuple tup = (0, 1, 2, 3, 4, 5) slist = list(tup) slist.append(6) tup = tuple(slist) # converting list back into a tuple print(tup)   # Modify nested items of a tuple: tup = (10, 20, [25, 75, 85]) print(tup) tup[2][0] = 250 print(tup)

Remove image background using python rembg module

  #remove image background using python rembg module from rembg import remove from PIL import Image input_path='lists.png'  #old image path output_path='lists-1.png' #new image path inp=Image.open(input_path) output=remove(inp) output.save(output_path) Note:first install rembg module using cmd pip install rembg rembg install only 3.8 later versions

remove specific element in python list - remove index based element

  #remove specific element in python list list=list([34,55,34,66,77,45.6,23,34,]) print(list) list.remove(66) print(list) output: [34, 55, 34, 66, 77, 45.6, 23, 34] [34, 55, 34, 77, 45.6, 23, 34] #Remove all occurrence of a specific python repeated element mylist = list([26, 4, 26, 26, 8, 12]) for item in mylist:     mylist.remove(26) print(mylist) output :  [4,8,12] #remove item present at given index mylist = list([2, 4, 6, 8, 10, 12]) mylist.pop(2)  #remove 2 index based element print(mylist) output:  [2, 4, 8, 10, 12] # remove item without passing index number(last value remove) using pop() mylist = list([2, 4, 6, 8, 10, 12]) mylist.pop()   print(mylist) output : [2, 4, 6, 8, 10] [2, 4, 8, 10] #remove the range of elements python list with slice: mylist = list([2, 4, 6, 8, 10, 12]) #remove item from index 2 to 5 del mylist[2:5] print(mylist) output: [2, 4, 12] #remove all items starting from index 2 mylist=list([23,44,55,34,53,78,55]) del myl...

How to add new element in python list using insert() extend() append() methods

 How to add new element in python list : list methods: insert():insert method to add the object/element at the specified position in the list,insert method accepts two parameters position and object syntax: insert(index,object) Ex: list=[30,50,60,70,80] list.insert(3,55) print(list) list.insert(3,[45,66,77]) #nested index print(list) output:[30,50,60,55,70,80] [30,50,60,[45,66,77],80] extend() or append() : extend method will accept the list of elements and add them at the end of the list Ex: #using extend or append mylist = list([5, 87, 'ravi', 3.50]) mylist.extend([25, 75, 10])  print(mylist) output:[5, 87, 'ravi', 3.50,25, 75, 10] #using extend or append mylist = list([5, 87, 'ravi', 3.50]) mylist.append([25, 75, 10])  #append add new elements to nested index print(mylist) output:[5, 87, 'ravi', 3.50,[25, 75, 10]] Modify:Modify the individual item,  Modify the range of items. Ex: mylist = list([5, 10, 20, 30]) mylist[2]=90 #single element modified pri...

Accessing elements of a python List - python list element slicing

 #Accessing elements of a List: we can access any item from a list using its index number forward index stat with 0 end with n-1 negative indexing stat with -1 # accessing 2nd element of the list Ex: mylist = [10, 20, 'ram', 12.50, 'ravi'] print(mylist[1])   output: 20 #Negative Indexing: # accessing last element of the list mylist = [10, 30, 'ram', 12.50, 'praveen'] print(mylist[-1]) python list element slicing: syntax for list slicing. listname[startindex : endindex : step] Ex: mylist = [10, 20, 'ram', 12.50, 'prasad', 25, 50] print(mylist[1:4]) print(mylist[:3])      print(mylist[::2])     print(mylist[::-2])   print(mylist[2:])    Note : # slice 1 index from before 4th index element  # slice first three elements # with a skip count 2 # reversing the list  # Stating from 2nd item to last item #Iterating a List : The objects in the list can be iterated over one by one, by using a for loop Ex: mylist = [15, 22, ...

python list heterogeneous items and python len() function

  The list data structure is very flexible It has many unique inbuilt functionalities Different methods of creating a list, adding, modifying, and deleting elements in the list. Also, learn how to iterate the list and access the elements in the list in detail. The following are the properties of a list. Mutable: The elements of the list can be modified. We can add or remove items to the list after it has been created. Ordered: The items in the lists are ordered. Heterogeneous: The list can contain different kinds of elements.i.e; they can contain elements of string, integer, boolean, or any type. Duplicates: The list can contain duplicates i.e., lists can have two items with the same values. Ex: mylist=[89,44,55,22,90] print(mylist) print(type(mylist)) output:89,44,55,22,90 #Using list() constructor: In general, the constructor of a class has its class name. mylist=list([34,55,66,77,23]) print(mylist) ouput:34,55,66,77,23 # list heterogeneous items mylist = [1.0, 'ram', 30,50...

Python Opps Concepts: class and Object - Class and Objects in Python

Python Opps: class and Object Python Opps Concepts : Class and Object What is a Class and Objects in Python? Class: The class is a user-defined data structure that binds the data members and methods into a single unit. Class is a blueprint or code template for object creation. Using a class, you can create as many objects as you want Object: An object is an instance of a class. It is a collection of attributes (variables) and methods. We use the object of a class to perform actions.  #print name and age input from user using python object and class  EX: class person:     name=input("enter name")     age=input("enter age")     def __init__(self,name,age):         self.name=name         self.age=age     def greet(self):         #print("name ",self.name,"age",self.age)         print(f"{self.name} is {self.age} years old") a=person(person.name,person.age) a.greet...

Python DataType Conversion Boolean value to an integer - Python integer to float datatype conversion

  Python Datatype Conversion   #Python DataType Conversion Boolean value to an integer flagtrue = True flagfalse = False print(type(flagtrue)) num1 = int(flagtrue) num2 = int(flagfalse) print("Integer number 1:", num1) print(type(num1))  print("Integer number 2:", num2) print(type(num2)) Output: <class 'bool'> Integer number 1: 1 <class 'int'> Integer number 2: 0 <class 'int'> # Python  integer to float datatype conversion num = 725 print(type(num)) num1 = float(num) print("Float number:", num1) print(type(num1)) Output: <class 'int'> Float number: 725.0 <class 'float'>

python float datatype - assigning a float value to a variable - floating-point value using float() class

  float datatype python float datatype we can declare float variable in two ways 1)Directly assigning a float value to a variable 2)Using a float() class. #Directly assigning a float value to a variable intrest=1250.80 print("intrest is ",intrest) print(type(intrest)) output:     1250.80 # store a floating-point value using float() class num = float(54) print(num) print(type(num)) output:     54.0

Typecasting or type conversion in python - float to int datatype conversion

Python Type Conversion and Type Casting  We can convert one type of variable to another type. This conversion is called type casting or type conversion. int(): convert any type variable to the integer type. float(): convert any type variable to the float type. complex(): convert any type variable to the complex type. bool(): convert any type variable to the bool type. str(): convert any type variable to the string type. #Type Casting float value to an integer float(): convert any type variable to the float type.  Ex pi = 3.14  print(type(pi))  num = int(pi)  print("Integer number:", num) print(type(num))

Python Complex Datatypes

Python Complex Datatypes    A complex number is a number with a real and an imaginary component represented as a+bj where a and b contain integers or floating-point values. # both values are int type a = 9 + 8j           print(a)      print(type(a)) # one int and one float values b = 10 + 4.5j        print(b)       print(type(b)) # both values are float type c = 11.2 + 1.2j      print(c) print(type(c))

python int()class - Binary-Octal-Hexadecimal-Decimal also integer Datatypes

#store integer using int() class #variable declaration with value assigning using int() class or contractor  empid = int(25) print(empid)   print(type(empid))   output : 25 <class : int> You can also store integer values other than base 10 such as Binary (base 2- 0,1) Octal (base 8 - 0,1,2,3,4,5,6,7) Hexadecimal numbers (base 16 - 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) Decimal (10 - 0,1,2,3,4,5,6,7,8,9) Octal : octnum=0o10 print(octnum) print(type(octnum)) output: 8 <class 'int'> Hexadecimal Numbers :  hexanum=0x10 print(hexanum) print(type(hexanum)) Output: 16 <class 'int'> Binary: binanum=0b10 print(binanum) print(type(binanum)) Output: 2 <class 'int'>

Datatypes in Python - int,float,complex,boolean,set,dictionary,Sequence: String, list, and tuple

Datatypes in Python Data types specify the different sizes and values that can be stored in the variable. For example, Python stores numbers, strings, and a list of values using different data types.   There are mainly Five types of basic/primitive data types available in Python Numeric : int, float, and complex Bool: true,false Sequence: String, list, and tuple Set Dictionary (dict) int datatype : # single variable declaration with value assigning  Ex: x=50 print(x) # multi variable declaration with value assigning Ex: x,y=90,60 print(x) print(y) # int variable declaration input from user  using input function Ex: x=int(input("enter x value")) print(x) print(type(x)) # display the datatype of x variable value #enter input value  50 output: 50 <class : int> # Variable declaration input from user without using input function roll_no=input("enter rollnumber") print(roll_no) print(type(roll_no)) input : enter roll_no  101 output: 101 <class ...

Types of Comments in Python - Creating a Comment

 Types of Comments in Python Two types of comments in python   Creating a Comment   single line Comments starts with a #, and Python will ignore them:    #print("Welcome to Training Center")   Multi-Line Comments starts with   """   This is a comment   written in     more than just one line    """   Ex:   #print('welcome to python single line comments')   x=90   print("x value is =",x)   output : x value is = 90  Ex: Multi-line Comments    """    print('Basic python programming language')   print("Web Designing and Web Development")  """   print(""" Mobile App Designing and Development""")   print("Python Frameworks : Django,Flask")  output:    Mobile App Designing and Development,  Python Frameworks : Django,Flask

The placeholders can be identified using named indexes {name}, numbered indexes {0}, or even empty placeholders {}.

 #Format Output String by its positions #The placeholders can be identified using named indexes {name}, numbered indexes {0}, or even empty placeholders {}. firstname = input("Enter First Name ") lastname = input("Enter Last Name ") organization = input("Enter Organization Name ") print('{0}, {1} works at {2}'.format(firstname, lastname, organization)) print('FirstName {0}, LastName {1} works at {2}'.format(firstname, lastname, organization))

Python input() and print() functions

  Python input() and print() functions Two built-in functions to handle input from a user and system. input(prompt): To accept input from a user. user enter input from keyboard print():print function is used To display output on the console/screen. Ex: # take three values from user name = input("Enter Employee Name: ") salary = int(input("Enter salary: ")) company = input("Enter Company name: ") # Display all values on screen print("Printing Employee Details") print("Name   Salary   Company") print(name,'\t',salary,'\t',company)

How to check the length of the elements in python list object

# How to check the length of the elements in python list object using len() function Length of a List In order to find the number of items present in a list, we can use the len() function. Ex: list=[20,33,44,55,"ramesh","rani",56.88] print(len(list)) # print secod index to upto end of the list values using len() function Ex: list=[20,33,44,55,"ramesh","rani",56.88] for x in range(2,len(list)):     print(list[x])

Iterating a List Object Values in Python

 # Iterating a List Object Values in Python : # The objects in the list can be iterated over one by one, by using a for loop Ex: courses=["python","Django","Flask","Pyspark"] for x in courses:     print(x) # Iterate along with an index number: Ex: mylist = [5, 8, 'ram', 7.50, 'ravi'] for i in range(2, len(mylist)):      print(mylist[i])

Python list datatype

  python list datatype: list is a flexible, versatile, powerful, and popular built-in data type. store multiple values in single variable and different datatypes we can use list datatype in two ways one is direct list variable ex: mylist=[10,20,40,50,90] print(mylist) second one is list() constructor its class name ex: mylist=list([10,30,40,60,90]) print(mylist) list heterogeneous items heterogeneous means group of datatypes Ex: mylist = [10, 20, 'ram', 12.50, 'praveen', 25, 50] print(mylist)

what is Framework

  Frame work  : framework are software that is developed  and used by developers to build applications Web framework : if is a software framework that is designed to supported the development of web applications including web services web resources web API's