o count the number of lines in the given text file.Input: noneOutput

Learning Goal: I’m working on a python discussion question and need guidance to help me learn.Q1.[1 point]Instruction : You are given a txt file named ‘weather_report.txt’ on D2L, download it and keep it in the same location where you have this notebook.For this problem on files, You are required to count the number of lines in the given text file.Input: noneOutput: intRubric: All or Nothing.Grading Rubric: 1 point if the output is correct. 0 otherwise (No Partial Marks).[18]

# Fill this function for your solution
def number_of_lines():
    fhand = open('weather_report.txt')
    count = 0
for line in fhand:
      count = count + 1
print('Line Count:', count)
[19]
# Do not change this cell
print(number_of_lines())
Q2.[4 points]For the file weather_report.txt, you have 4 floating point numbers in each line as per the format below.(Min Temperature(in C), Max Temperature(in C), Humidity%, Rainfall(in)) for a particular day.You are given a prediction algorithm which has the logic that if Max temperature - Min temperature is greater than 10 and if humidity is greater than 50%, it is a rainy day else it is sunny.If we predict a day to be rainy using the above algorithm and actual rainfall for that day in the dataset is greater than 0 then it's correct else it's a wrong prediction. Similarly, if we predict sunny and rainfall is 0, then it's correct else it's a wrong prediction.Your task is to return the total number of correct predictions corresponding to the dataset and the prediction algorithm.Note: Read data from the file.Input: none Output: intRubric : All/NothingGrading Rubric: 4 points if output is correct. (0, otherwise)[ ]
def model_accuracy():
pass
Q3 [2 points]A String is determined to be fair if it satisfies any of the 3 conditions :Every letter in the string is a capital, like "USC" (or) Every letter is not uppercase , like "assignment" (or) Only the initial character in the word is capital, like "This".Note : The input string will only have alphabets.Input: StringOutput: StringExample:Input
USC
Output
FairInput
USb
Output
Not FairGrading Rubric: All or Nothing (+2 if All Cases pass, else 0)[ ]
def is_fair(s):
pass
Q4 [3 points]Hopefully you all remember the work with Palindromes in the previous Lab (Lab-3). Given a list of words, your task is to return the first palindromic string in the list. If the list has no such matching string then return an empty string "".Note: You can reuse any of your own functions from the previous labs, if need be.Definition : A string is said to be a palindrome if it reads the same in both forward and backward directions.Input: List of Strings Output: StringExample:Input
words = ["asd","capital","aba","southern","california"]
Output
'aba'Input
words = ["asddd","abcdefghi"]
Output
''Grading Rubric: All or Nothing (+3 if All Cases pass, else 0)[ ]
def firstPalindrome(words):
pass
[ ]
#Sample example for you to test. Don't need to submit this cell.
words = ["asd","capital","aba","southern","california"]
[ ]
# Again another sample for you to call your function. Just for you to test
firstPalindrome(words)
Bonus [2 points]Our favourite detective Sherlock has a been given a cipher to decode and needs your help. The key to the cipher is to solve a substring problem. He's given a String X, consisting of just 2 characters 'a' and 'b', and wants to find out the number of substrings of X which start and end with the character 'a'.Your task is to find out the number of such subtrings.Input: StringOutput: intExample:Input
ababab
Output
6Input
aa
Output
3Grading Rubric: All or Nothing (+2 if All Cases pass, else 0)[ ]def count_substring(X):pass
Requirements: just a few lines each   |   .doc file
Calculate your order
Pages (275 words)
Standard price: $0.00
Client Reviews
4.9
Sitejabber
4.6
Trustpilot
4.8
Our Guarantees
100% Confidentiality
Information about customers is confidential and never disclosed to third parties.
Original Writing
We complete all papers from scratch. You can get a plagiarism report.
Timely Delivery
No missed deadlines – 97% of assignments are completed in time.
Money Back
If you're confident that a writer didn't follow your order details, ask for a refund.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00
Power up Your Academic Success with the
Team of Professionals. We’ve Got Your Back.
Power up Your Study Success with Experts We’ve Got Your Back.