Subscribe this Blog

Wikipedia

Search results

Notifications and New Posts!

Monday, September 28, 2020

Practice MCQs of ADVANCED PROGRAMMING CONCEPTS - Python (TY A and B)

Subject : ADVANCED PROGRAMMING CONCEPTS

Test Series - 1

Semester - 1

AY: 2020-21

Class: TY Mechanical Division A and B

Date: 03/10/2020

Time 10:00 am to 12:00 pm

Marks - 30

Test will be conducted in the form of Google Form.

Test series 1 Format:

1.Only MCQ based 

2. 30 MCQ questions

3. Test 1 will be based on following units

Unit 1 : Introduction to Python and Computer Programming 
(Syllabus - 100%)
Unit 2: Data types, Variables, Basic input-output operations, Basic Operators 
(Syllabus  Up to List and tuple python literals only)


Please find Practice MCQs of ADVANCED PROGRAMMING CONCEPTS - Python

https://quizizz.com/admin/quiz/5e5940ed4ffc65001b42a0a6

https://quizizz.com/admin/quiz/5c518a3a7662ff001b0eaabd

https://quizizz.com/admin/quiz/5bbbc007cabb4b001a17c20b

https://quizizz.com/admin/quiz/5c7ed8ffa1e546001a9bdeb5

https://quizizz.com/admin/quiz/5c007dae52934c001f2d17dc

https://quizizz.com/admin/quiz/5e738995cd8e03001dc01f77

https://quizizz.com/admin/quiz/5f27d18d7e8843001b7f9605

With kind regards,

#sdbhosale


Thursday, September 24, 2020

Google Meet Session - 24th September 2020 ADVANCED PROGRAMMING CONCEPTS - Python (TY A and B)

 ADVANCED PROGRAMMING CONCEPTS - Python

Thursday, 24 September13:30 – 15:30
Weekly on Thursday, until 30 Nov 2020
Join with Google Meet
https://meet.google.com/hid-dmnv-qxw
Join by phone

Description:Subject : ADVANCED PROGRAMMING CONCEPTS - Python To solve assignments Please join Google Classroom. Invitation of Google Classroom has been sent to your official email id. Please accept the google classroom invitation through official email id. Or directly by entering Class code of Google Classroom also you can join Google Class room to solve assignments. Class code of Google Classroom : 3ojdsjm With kind regards, SD Bhosale

Organiser: Sachin Bhosale

To know attendance : Click here
Today's Learning:


# Example
# Check if "banana" is present in the set:

thisset = {"apple", "banana", "cherry"}
print("cherry" in thisset)
print("kiwi" in thisset)
print("apple" in thisset,"banana" in thisset)
Output:
True
False
True True

# Change Items
# Once a set is created, you cannot change its items,
# but you can add new items.


# Add Items
# To add one item to a set use the add() method.
# To add more than one item to a set use the update() method.
# Example
# Add an item to a set, using the add() method:

thisset = {"apple", "banana", "cherry","banana","cherry"}
thisset.add("kiwi")
thisset.add("chiku")
thisset.add("apple")
print(thisset)
Output:
{'chiku', 'apple', 'banana', 'kiwi', 'cherry'}

# Example
# Add multiple items to a set, using the update() method:

thisset = {"apple", "banana", "cherry"}
print(thisset)
thisset.update(["apple", "mango", "grapes","chiku"])
#thisset.update({"orange", "mango", "grapes"})
#thisset.update(("orange", "mango", "grapes"))
print(thisset)
Output:
{'banana', 'apple', 'cherry'}
{'apple', 'chiku', 'grapes', 'cherry', 'banana', 'mango'}

# Get the Length of a Set
# To determine how many items a set has, use the len() method.
# Example
# Get the number of items in a set:

thisset = {"apple", "banana", "cherry","apple"}
print(len(thisset))
Output:
3

# Remove Item
# To remove an item in a set, use the remove(),
# or the discard() method.
# Example
# Remove "banana" by using the remove() method:
#Note: If the item to remove does not exist, remove() will raise an error.
thisset = {"apple", "banana", "cherry"}
thisset.remove("banana")
#thisset.remove("kiwi")
print(thisset)
Output:
{'apple', 'cherry'}

# Remove Item
# To remove an item in a set, use the remove(),
# or the discard() method.
# Example
# Remove "banana" by using the remove() method:
#Note: If the item to remove does not exist, remove() will raise an error.
thisset = {"apple", "banana", "cherry"}
thisset.remove("banana")
thisset.remove("kiwi")
print(thisset)
Output:
Traceback (most recent call last):
  File "C:/Users/Hp/PycharmProjects/python_set/8.py", line 9, in <module>
    thisset.remove("kiwi")
KeyError: 'kiwi'

# Example
# Remove "banana" by using the discard() method:
#Note: If the item to remove does not exist, discard() will NOT raise an error.
thisset = {"apple", "banana", "cherry"}
thisset.discard("banana")
thisset.discard("kiwi")
print(thisset)
Output:
{'apple', 'cherry'}

# You can also use the pop(), method to remove an item,
# but this method will remove the last item.
# Remember that sets are unordered,
# so you will not know what item that gets removed.
# The return value of the pop() method is the removed item.
# Example
# Remove the last item by using the pop() method:
#Note: Sets are unordered, so when using the pop() method,
# you will not know which item that gets removed.
thisset = {"apple", "banana", "cherry"}
x = thisset.pop()
print(x)
print(thisset)
x = thisset.pop()
print(x)
print(thisset)
x = thisset.pop()
print(x)
print(thisset)
Output:
apple
{'banana', 'cherry'}
banana
{'cherry'}
cherry
set()

# Example
# The clear() method empties the set:

thisset = {"apple", "banana", "cherry"}
thisset.clear()
print(thisset)
Output:
set()

# Example
# The del keyword will delete the set completely:

thisset = {"apple", "banana", "cherry"}
del thisset
print(thisset)
Output:
Traceback (most recent call last):
  File "C:/Users/Hp/PycharmProjects/python_set/12.py", line 6, in <module>
    print(thisset)
NameError: name 'thisset' is not defined

# Example
# The del keyword will delete the set completely:

thisset = {"apple", "banana", "cherry"}
del thisset
#print(thisset)
Output:


# Join Two Sets
# There are several ways to join two or more sets in Python.
# You can use the union() method that returns a new set containing all items from both sets,
# Example
# The union() method returns a new set with all items from both sets:
# + operator can not be used for set to join two sets
set1 = {"a", "b" , "c"}
set2 = {1, 2, 3,"c"}
set5={10, 20, 30}
set4=set1.union(set2)
print(set4)
set3=set1.union(set2,set5,set1)
print(set3)
# set3=set2.union(set1)
# print(set3)
#print(set1)

# set4=set1+set2
# print(set4)
Output:
{1, 2, 'c', 3, 'a', 'b'}
{1, 2, 3, 'a', 'b', 10, 'c', 20, 30}

# Example
# The update() method inserts the items in set2 into set1:
# Note: Both union() and update() will exclude any duplicate items.
# The update() method that inserts all the items from one set into another:
set1 = {"a", "b" , "c"}
set2 = {1, 2, 3}

set1.update(set2)
print(set1)
print(set2)
# set2.update(set1)
# print(set2)
Output:
{'a', 1, 2, 3, 'b', 'c'}
{1, 2, 3}

# The set() Constructor
# It is also possible to use the set() constructor to make a set.
# Example
# Using the set() constructor to make a set:

thisset = set(("apple", "banana", "cherry"))
print(thisset)

thisset = set(["apple", "banana", "cherry"])
print(thisset)

thisset = set({"apple", "banana", "cherry"})
print(thisset)

Output:
{'cherry', 'banana', 'apple'}
{'cherry', 'banana', 'apple'}
{'cherry', 'banana', 'apple'}

Please explore following set methods:

# Set Methods
# Python has a set of built-in methods that you can use on sets.
# Method Description
# add() Adds an element to the set
# clear() Removes all the elements from the set
# copy() Returns a copy of the set
# difference() Returns a set containing the difference between two or more sets
# difference_update() Removes the items in this set that are also included in another, specified set
# discard() Remove the specified item
# intersection() Returns a set, that is the intersection of two other sets
# intersection_update() Removes the items in this set that are not present in other, specified set(s)
# isdisjoint() Returns whether two sets have a intersection or not
# issubset() Returns whether another set contains this set or not
# issuperset() Returns whether this set contains another set or not
# pop() Removes an element from the set
# remove() Removes the specified element
# symmetric_difference() Returns a set with the symmetric differences of two sets
# symmetric_difference_update() inserts the symmetric differences from this set and another
# union() Return a set containing the union of sets
# update() Update the set with the union of this set and others

# Dictionary
# A dictionary is a collection which is unordered, changeable and indexed.
# In Python dictionaries are written with curly brackets, and they have keys and values.
# Example
# Create and print a dictionary:

vehicle = {
  "brand": "Maruti",
  "model": "K10",
  "cc": 1000
}
print(vehicle)
Output:
{'brand': 'Maruti', 'model': 'K10', 'cc': 1000}

With kind regards,

#sdbhosale


Google Meet Recorded Session with OBS:


YouTube Channel.

<! -- The End -->

Saturday, September 19, 2020

Google Meet Session - 19th September 2020 ADVANCED PROGRAMMING CONCEPTS - Python (TY A and B)

 ADVANCED PROGRAMMING CONCEPTS - Python

Saturday, 19 September16:00 – 17:00
Weekly on Saturday, until 30 Nov 2020
Join with Google Meet
https://meet.google.com/fza-dxad-utd
Description: Subject : ADVANCED PROGRAMMING CONCEPTS - Python To solve assignments Please join Google Classroom. Invitation of Google Classroom has been sent to your official email id. Please accept the google classroom invitation through official email id. Or directly by entering Class code of Google Classroom also you can join Google Class room to solve assignments. Class code of Google Classroom : 3ojdsjm With kind regards, SD Bhosale
  1. 5 minutes before
Organiser: Sachin Bhosale

To know attendance : Click here (Sorry! I forgot to mark attendance!)

Program No. 1:
# Tuple Length
# To determine how many items a tuple has, use the len() method:
# Example
# Print the number of items in the tuple:

thistuple = ("apple", "banana", "cherry","kiwi","chiku")
print(len(thistuple))
Output:
5

Program No. 2:
# Add Items
# Once a tuple is created, you cannot add items to it.
# Tuples are unchangeable.
# Example
# You cannot add items to a tuple:

thistuple = ("apple", "banana", "cherry")
thistuple[1] = "orange" # This will raise an error
print(thistuple)
Output:
Traceback (most recent call last):
  File "C:/Users/Hp/PycharmProjects/python_tuple/8.py", line 9, in <module>
    thistuple[1] = "orange" # This will raise an error
TypeError: 'tuple' object does not support item assignment

Program No. 3:
# Create Tuple With One Item
# To create a tuple with only one item, you have to add a comma after the item,
# otherwise Python will not recognize it as a tuple.
# Example
# One item tuple, remember the commma:

thistuple = ("apple",)
print(type(thistuple))

#NOT a tuple
thistuple = ("apple")
print(type(thistuple))
Output:
<class 'tuple'>
<class 'str'>

Program No. 4:
# Remove Items
# Note: You cannot remove items in a tuple.
# Tuples are unchangeable, so you cannot remove items from it,
# but you can delete the tuple completely:
# Example
# The del keyword can delete the tuple completely:

thistuple = ("apple", "banana", "cherry")
del thistuple
#print(thistuple)
#this will raise an error because the tuple no longer exists
Output:


Program No. 5:
# Remove Items
# Note: You cannot remove items in a tuple.
# Tuples are unchangeable, so you cannot remove items from it,
# but you can delete the tuple completely:
# Example
# The del keyword can delete the tuple completely:

thistuple = ("apple", "banana", "cherry")
del thistuple
print(thistuple)
#this will raise an error because the tuple no longer exists
Output:
Traceback (most recent call last):
  File "C:/Users/Hp/PycharmProjects/python_tuple/10.py", line 10, in <module>
    print(thistuple)
NameError: name 'thistuple' is not defined

Program No. 6:
# Join Two Tuples
# To join two or more tuples you can use the + operator:
# Example
# Join two tuples:
tuple1 = ("a", "b" , "c")
tuple2 = (1,)
tuple4=(2.0,)

tuple3 = tuple1 + tuple2 + tuple4
print(tuple3)
Output:
('a', 'b', 'c', 1, 2.0)

Program No. 7:
# Join Two Tuples
# To join two or more tuples you can use the + operator:
# Example
# Join two tuples:
tuple1 = ("a", "b" , "c")
tuple2 = (1,)
tuple4=(2.0)

tuple3 = tuple1 + tuple2 + tuple4
print(tuple3)
Output:
Traceback (most recent call last):
  File "C:/Users/Hp/PycharmProjects/python_tuple/11.py", line 9, in <module>
    tuple3 = tuple1 + tuple2 + tuple4
TypeError: can only concatenate tuple (not "float") to tuple

Program No. 8:
# The tuple() Constructor
# It is also possible to use the tuple() constructor to make a tuple.
# Example
# Using the tuple() method to make a tuple:


thistuple = tuple(["apple", "banana", "cherry"]) # note the double round-brackets or Square bracket
print(thistuple)
print(type(thistuple))
Output:
('apple', 'banana', 'cherry')
<class 'tuple'>

Program No. 9:
# Tuple Methods
# In case of tuple, following two methods are python methods. They are not built-in methods
# Method Description
# count() Returns the number of times a specified value occurs in a tuple
# index() Searches the tuple for a specified value and returns the position of where it was found

thistuple=("Ganesh","Ramesh","Rupesh","Rupesh","Ganesh","ganesh")

values_in_thistuple=thistuple.count("Ganesh")

print("Ganesh","is present ",values_in_thistuple,"times!")

print(thistuple.count("Ganesh"))
print(thistuple.index("Ramesh"))
Output:
Ganesh is present  2 times!
2
1

Let's Learn Set - python literal now

Program No. 1:
# Set
# A set is a collection which is unordered and unindexed.
# In Python sets are written with curly brackets.
#Note: Sets are unordered, so you cannot be sure in which order the items will appear.
# Example
# Create a Set:

thisset = {"apple", "banana", "cherry",1,2.0}
print(type(thisset))
print(thisset)
Output:
<class 'set'>
{'apple', 1, 'cherry', 2.0, 'banana'}

Program No. 2:
# Access Items
# You cannot access items in a set by referring to an index,
# since sets are unordered the items has no index.
# But you can loop through the set items using a for loop,
# or ask if a specified value is present in a set, by using the in keyword.
# Example
# Loop through the set, and print the values:

set1 = {"apple", "banana", "cherry","kiwi"}

for w in set1:
  print(w)
  print("welcome")

Output:
apple
welcome
kiwi
welcome
banana
welcome
cherry
welcome

Program No. 3:
# Access Items
# You cannot access items in a set by referring to an index,
# since sets are unordered the items has no index.
# But you can loop through the set items using a for loop,
# or ask if a specified value is present in a set, by using the in keyword.
# Example
# Loop through the set, and print the values:

set1 = {"apple", "banana", "cherry","kiwi"}

for w in set1:
  print(w)
print("welcome")
Output:
banana
kiwi
apple
cherry
welcome

With kind regards,

#sdbhosale


Recorded Google Meet Session Session with OBS


YouTube Channel.

<! -- The End -->

Thursday, September 17, 2020

Google Meet Session - 17th September 2020 ADVANCED PROGRAMMING CONCEPTS - Python (TY A and B)

 ADVANCED PROGRAMMING CONCEPTS - Python

Thursday, 17 September13:30 – 15:30
Weekly on Thursday, until 30 Nov 2020
Join with Google Meet
meet.google.com/hid-dmnv-qxw
Join by phone
Description:Subject : ADVANCED PROGRAMMING CONCEPTS - Python To solve assignments Please join Google Classroom. Invitation of Google Classroom has been sent to your official email id. Please accept the google classroom invitation through official email id. Or directly by entering Class code of Google Classroom also you can join Google Class room to solve assignments. Class code of Google Classroom : 3ojdsjm With kind regards, SD Bhosale


To know Attendance: Click here
Reference : https://www.w3schools.com/python/

Today's Learning:

Revision of Python List -Literal 
 
Program No. 1:
# Tuple
# A tuple is a collection which is ordered and unchangeable.
# In Python tuples are written with round brackets.
# Example
# Create a Tuple:

thistuple = ("apple", "banana", "cherry")
print(thistuple)
print(type(thistuple))
Output:
('apple', 'banana', 'cherry')
<class 'tuple'>

Program No. 2:
# Access Tuple Items
# You can access tuple items by referring to the index number,
# inside square brackets:
# Example
# Print the second item in the tuple:

thistuple = ("apple", "banana", "cherry","chiku")
print(thistuple[0:2])
Output:
('apple', 'banana')


Program No. 3:
# Negative Indexing
# Negative indexing means beginning from the end,
# -1 refers to the last item, -2 refers to the second last item etc.
# Example
# Print the last item of the tuple:

thistuple = ("chiku","apple", "banana", "cherry")
print(thistuple[-4])
Output:
chiku


Program No. 4:
# Range of Indexes or Slicing
# You can specify a range of indexes by specifying where
# to start and where to end the range.
# When specifying a range, the return value will be
# a new tuple with the specified items.
# Example
# Return the third, fourth, and fifth item:
# Note: The search will start at index
# 2 (included) and end at index 5 (not included).
# Remember that the first item has index 0.

thistuple = ("apple", "banana", "cherry", "orange", "kiwi", "melon", "mango")
print(thistuple[0:3])
Output:
('apple', 'banana', 'cherry')


Program No. 5:
# Range of Negative Indexes
# Specify negative indexes if
# you want to start the search from the end of the tuple:
# Example
# This example returns the items
# from index -4 (included) to index -1 (excluded)

thistuple = ("apple", "banana", "cherry", "orange", "kiwi", "melon", "mango")
print(thistuple[-10:-1])
Output:
('apple', 'banana', 'cherry', 'orange', 'kiwi', 'melon')


Program No. 6:
# Change Tuple Values
# Once a tuple is created, you cannot change its values.
# Tuples are unchangeable, or immutable.

# But there is a workaround. You can convert the tuple into a list,
# change the list, and convert the list back into a tuple.
# Example
# Convert the tuple into a list to be able to change it:

x = ("apple", "banana", "cherry")
print(x)
print(type(x))
y = list(x)
print(type(y))
print(y)
y[1] = "kiwi"
x = tuple(y)
print(x)
Output:
('apple','kiwi','cherry')

With kind regards,

#sdbhosale



Google Meet Session Video:



Saturday, September 12, 2020

Google Meet Session - 12th September 2020 ADVANCED PROGRAMMING CONCEPTS - Python (TY A and B)

 ADVANCED PROGRAMMING CONCEPTS - Python
Saturday, 12 September16:00 – 17:00
Weekly on Saturday, until 30 Nov 2020
Join with Google Meet
https://meet.google.com/fza-dxad-utd
Description: Subject : ADVANCED PROGRAMMING CONCEPTS - Python To solve assignments Please join Google Classroom. Invitation of Google Classroom has been sent to your official email id. Please accept the google classroom invitation through official email id. Or directly by entering Class code of Google Classroom also you can join Google Class room to solve assignments. Class code of Google Classroom : 3ojdsjm With kind regards, SD Bhosale
  1. 5 minutes before

Organiser: Sachin Bhosale

To know attendance : Click here

Reference : https://www.w3schools.com/python/
Today's Learnings:
Program No.1
# Remove Item
# There are several methods to remove items from a list:
# Example
# The remove() method removes the specified item:

thislist = [2.0, "banana", "cherry",2.0]
print("Before removing: ",thislist)
thislist.remove(2.0)
print("after removing: ",thislist)
thislist.remove("banana")
print("after removing: ",thislist)
Output:
Before removing:  [2.0, 'banana', 'cherry', 2.0]
after removing:  ['banana', 'cherry', 2.0]
after removing:  ['cherry', 2.0]

Program No.2
# The pop() method removes the specified index,
# (or the last item if index is not specified):

thislist = ["apple", "banana", "cherry","apple"]
thislist.pop()
print(thislist)

thislist.pop(0)
print(thislist)
Output:
['apple', 'banana', 'cherry']
['banana', 'cherry']

Program No.3
# The del keyword removes the specified index:
thislist = ["apple", "banana", "cherry"]
del thislist[2]
print(thislist)
Output:
['apple', 'banana']

Program No.4
# The del keyword can also delete the list completely:
thislist = ["apple", "banana", "cherry"]
print("Before Deleting entire list: ",thislist)
del thislist
#thislist = [1,2,3]
print(thislist)
Output:
Traceback (most recent call last):
  File "C:/Users/Hp/PycharmProjects/python_list/15.py", line 7, in <module>
Before Deleting entire list:  ['apple', 'banana', 'cherry']
    print(thislist)
NameError: name 'thislist' is not defined


Program No.5
# The del keyword can also delete the list completely:
thislist = ["apple", "banana", "cherry"]
print("Before Deleting entire list: ",thislist)
del thislist
Output:
Before Deleting entire list:  ['apple', 'banana', 'cherry']

Program No.6
# Example
# The clear() method empties the list:
thislist = ["apple", "banana", "cherry"]
print("Before clearing the list: ",thislist)
thislist.clear()
print("After clearing the list: ",thislist)
print(thislist)
Output:
Before clearing the list:  ['apple', 'banana', 'cherry']
After clearing the list:  []
[]

Program No.7
# Copy a List
# You cannot copy a list simply by typing list2 = list1,
# because: list2 will only be a reference to list1, and
# changes made in list1 will automatically also be made in list2.
# There are ways to make a copy, one way is to use the built-in List method copy().
# Example
# Make a copy of a list with the copy() method:

thislist = ["apple", "banana", "cherry"]
print("thislist:",thislist)
newlist=thislist.copy()
print("newlist:",newlist)
Output:
thislist: ['apple', 'banana', 'cherry']
newlist: ['apple', 'banana', 'cherry']

Program No.8
# Another way to make a copy is to use the built-in method list().
# Example
# Make a copy of a list with the list() method:

thislist = ["apple", "banana", "cherry"]
mylist = list(thislist)
print(mylist)
print(type(thislist))
Output:
['apple', 'banana', 'cherry']
<class 'list'>

Program No.9
# Join Two Lists
# There are several ways to join, or concatenate, two or more lists in Python.
# One of the easiest ways are by using the + operator.
# Example
# Join two list:

list1 = ["a", "b" , "c"]
list2 = [1, 2, 3]
list4=[2.6]
list3 = list1 + list2 + list4
print("list1: ",list1)
print("list2: ",list2)
print("list3: ",list3)
Output:
list1:  ['a', 'b', 'c']
list2:  [1, 2, 3]
list3:  ['a', 'b', 'c', 1, 2, 3, 2.6]

Program No.10
# you can use the extend() method, which purpose is to add elements from one list to another list:
# Example
# Use the extend() method to add list2 at the end of list1:

list1 = ["a", "b" , "c"]
list2 = [1, 2, 3]

list1.extend(list1)
print("list1: ",list1)
Output:
list1:  ['a', 'b', 'c', 'a', 'b', 'c']

Program No.11
list1 = ["a", "b" , "c"]
list2 = [1, 2, 3]

list2.extend(list1)
print("list2: ",list2)
Output:
list2:  [1, 2, 3, 'a', 'b', 'c']

list1 = ["a", "b" , "c"]
list2 = [1, 2, 3]

list2.extend(list1)
print("list2: ",list2)

list3=[]
list3.extend(list1)
print("list3: ",list3)
Output:
list2:  [1, 2, 3, 'a', 'b', 'c']
list3:  ['a', 'b', 'c']

Program No.12
# The list() Constructor
# It is also possible to use the list() constructor to make a new list.
# Example
# Using the list() constructor to make a List:

thislist = list(("apple", "banana", "cherry")) # note the double round-brackets or []
print(thislist)
Output:
['apple', 'banana', 'cherry']

With kind regards,

#sdbhosale



Google Meet Session: