Answer:
ok
Explanation:
i will search it for you give me a moment
Answer:
class Cat:
isHungry = None
play = Cat().isHungry = True
eat = Cat().isHungry = False
if play:
print("I am hungry, I cannot play")
else:
play = Cat().isHungry = False
if eat:
print("I am full, I cannot eat")
else:
eat = Cat().isHungry = True
Explanation:
Just simple if and else statements.
Answer:
The main purpose of the file name extension is that in the operating system it basically helpful for knowing the actual name of the file which we want to open in the system. The file name extension is also known as file suffix and file extension.
The file name extension are the character and gathering of the given characters after some time period that making the whole name of the record in the file system.
It basically enables a working framework, such as Windows and mac operating system (OS), figure out which programming on our PC the document is related with the particular file.
We can easily restore our file from hard disk system by two main ways as follows:
- We can easily recover our file from the computer backup.
- Checked your deleted file in the recycle bin and then restore it.
Answer:
See explaination
Explanation:
def readFileFirstLast(filename):
# doc string
''' Function accept the filename and opens the fle
and reads all lines and strips new line character and
stores first and last in a string and return that string'''
#eception handle if file not found
try:
#opening the file
f = open(filename)
#reading the first line and striping the ne line
string = f.readline().strip()
#iterating until last line
for line in f:
pass
#concate the last line after strip the new line character to the string
string = string + " " + line.strip()
#return the string
return string
except:
#if file not found
return "File not found"
#taking the file name from user
filename = input("Enter a file name: ")
#printing the doc string in function
print("\ndoc_sting: \n"+ readFileFirstLast.__doc__+"\n")
#printing the returned string by calling the readFileFirstLast()
print("output string :")
print(readFileFirstLast(filename))