Answer:
Code is given as below:
Explanation:
def open_file():
fpointer = open('example.txt')
return fpointer
def main():
dictlist = []
dict_of_words = dict()
fp = open_file()
# loop to iterate over lines in file
for line in fp:
for word in line.split():
if(not dict_of_words.get(word)):
dict_of_words[word] = 1
else:
dict_of_words[word] += 1
for key, value in dict_of_words.items():
temp = (key.lower(), value)
dictlist.append(temp)
print(sorted(dictlist))
main()
Explanation:
bdhabsusvsjsvdhewjsbdueyssbwksv
Answer:
Add this statement at the end of your steps() function
return ""
This statement will not print None at the end of steps.
Explanation:
Here is the complete function with return statement added at the end:
def steps(number): # function steps that takes number (number of steps to print) as parameter and prints the steps specified by number
i = 1 #assigns 1 to i
while i < number + 1:
string = str(i) * 3 #multiplies value of i by 3 after converting i to string
string1 = str(string) # stores the step pattern to string1
if i != 0: # if the value of i is not equal to 0
string1 = (i * 4*' ' + "\b" + "\b" + "\b" + "\b") + string #set the spaces between steps
elif i == 1: # if value of i is equal to 1
string1 = string #set the string to string1
print(string1) # print string1
i = i + 1 # increments i at each iteration
return "" #this will not print None at the end of the steps and just add a an empty line instead of None.
Screenshot of the corrected program along with its output is attached.
Using python knowledge and writing code importing pandas, it is possible to create a function that corresponds to what you want.
<h3>Writting in python:</h3>
<em>import pandas as pd</em>
<em>if __name__ == "__main__":</em>
<em> df=pd.read_csv('mtcars.csv')</em>
<em> cylinders=int(input())</em>
<em> print(df[df.cyl==cylinders].shape)</em>
See more about python at brainly.com/question/18502436
#SPJ1