Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Practise #7

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions AppendingFile.py → ...nner-to-AdvanceEasy-Way-/AppendingFile.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'''
Appending File
'''
# Appending File
with open('newbucket.txt','a') as tem_bucket:
for i in range(1,11):
for j in range(1,11):
print(f"{i} * {j} : {i*j}",file=tem_bucket)
print("-"*15,file=tem_bucket)
'''
Appending File
'''

# Appending File
with open('newbucket.txt','a') as tem_bucket:
for i in range(1,11):
for j in range(1,11):
print(f"{i} * {j} : {i*j}",file=tem_bucket)
print("-"*15,file=tem_bucket)
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
"""
Argumented Assignments
E.g,
a=5
a+=1 (o/p is 6)/ (Same as a=a+1)
"""
#E.g,
a=10
# a=a+1
#a+=1
#a=a-1
#a-=1
# a=a*2
# a*=2
# a=a**2
# a**=2
# a=a/2
# a/=2
# a=a//2
# a//=2
"""
Argumented Assignments
E.g,
a=5
a+=1 (o/p is 6)/ (Same as a=a+1)
"""

#E.g,

a=10
# a=a+1
#a+=1
#a=a-1
#a-=1
# a=a*2
# a*=2
# a=a**2
# a**=2
# a=a/2
# a/=2
# a=a//2
# a//=2
print(a)
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
"""
Attributes and Method
"""
# #E.g 1),
# # Attribute
# class map():
# material = 'house'
# print(f'I build {material}')
#
# house1 = map()
#
# house2 = map()
# house3 = map()
# house1.material = 'new_house' # adding new value to the existing attribute
# house1.material2 = 'Very Good house' # Creating new attribute in class map
# print(house1.material) # new added attribute
# print(house1.material2) # new created attribute
# o/p
# I build house
# new_house
# Very Good house
# E.g 2),
# method
# if in class 'self' keyword in function then it is not function it is method
class map():
material = 'house'
print(f'I build {material}')
def adder(self):
x=2+2
return x
house = map()
print(house.material)
print(house.adder())
# o/p
# I build house
# house
# 4
"""
Attributes and Method
"""
# #E.g 1),
# # Attribute
# class map():
# material = 'house'
# print(f'I build {material}')
#
# house1 = map()
#
# house2 = map()
# house3 = map()
# house1.material = 'new_house' # adding new value to the existing attribute
# house1.material2 = 'Very Good house' # Creating new attribute in class map
# print(house1.material) # new added attribute
# print(house1.material2) # new created attribute
# o/p
# I build house
# new_house
# Very Good house

# E.g 2),
# method
# if in class 'self' keyword in function then it is not function it is method
class map():
material = 'house'
print(f'I build {material}')
def adder(self):
x=2+2
return x

house = map()
print(house.material)
print(house.adder())
# o/p
# I build house
# house
# 4
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
"""
Built in Method call on string
*To use built in function on string first type the name of variable and then
type dot and function name.(Refere E.g 1, 2)
* Press Ctrl and click on the function call to get all info of the function
"""
# E.g 1),
message= "Hello Python My name is Abhijit"
print(message.lower())
#O/p hello python my name is abhijit
# E.g 2),
print(message.upper())
#o/p HELLO PYTHON MY NAME IS ABHIJIT
# E.g 3),
# strip function use to remove unwanted spaces from string
print(message.strip())
# o/p Hello Python My name is Abhijit (Removed unwanted space)
# E.g 3),
# split function use to split string
print(message.split())
#o/p ['Hello', 'Python', 'My', 'name', 'is', 'Abhijit']
# E.g 4),
# find function is used to find indexing location of string which is mention in the find function
print(message.find('Hello'))
#o/p 24 (indexing location of 'is'.)
# E.g 5),
# replace method used to replace string (as a argument first argument is old string and second is new string )
print(message.replace('Hello','Hi'))
#o/p Hi Python My name is Abhijit
# E.g 6),
# startswith method is used to find the first character of the string
print(message.startswith('H'))
#O/p True (Returns true or false) have to give argument as a first character of the string
# E.g 7),
## endswith method is used to find the last character of the string
print(message.endswith('A'))
"""
Built in Method call on string
*To use built in function on string first type the name of variable and then
type dot and function name.(Refere E.g 1, 2)
* Press Ctrl and click on the function call to get all info of the function
"""

# E.g 1),
message= "Hello Python My name is Abhijit"
print(message.lower())
#O/p hello python my name is abhijit

# E.g 2),
print(message.upper())
#o/p HELLO PYTHON MY NAME IS ABHIJIT

# E.g 3),
# strip function use to remove unwanted spaces from string
print(message.strip())
# o/p Hello Python My name is Abhijit (Removed unwanted space)

# E.g 3),
# split function use to split string
print(message.split())
#o/p ['Hello', 'Python', 'My', 'name', 'is', 'Abhijit']

# E.g 4),
# find function is used to find indexing location of string which is mention in the find function
print(message.find('Hello'))
#o/p 24 (indexing location of 'is'.)

# E.g 5),
# replace method used to replace string (as a argument first argument is old string and second is new string )
print(message.replace('Hello','Hi'))
#o/p Hi Python My name is Abhijit

# E.g 6),
# startswith method is used to find the first character of the string
print(message.startswith('H'))
#O/p True (Returns true or false) have to give argument as a first character of the string

# E.g 7),
## endswith method is used to find the last character of the string
print(message.endswith('A'))
# O/p False (Returns true or false) have to give argument as a last character of the string
Loading