Using python beginner code see example code of what to use for this assignment
we have gathered together some interesting data into a file called harvardLightning.txt
The file contains all recorded lightning strikes in the harvard area
Parsing
Review alist = str.split() # alist will contain the elements of str - split using whitespace
Specifying a delimiter
Examples: delimiter = ',' delimiter = '-', delimiter = ';'
Stripping specified characters
Example: astring.strip('\n')
Avoid blank lines: if len(line) == 0:
continue
Splitting on commas
Your task is to extract the dates and the corresponding number of lightning strikes
2014-04-10 : 1 lightning strikes were recorded.
2014-04-21 : 19 lightning strikes were recorded.
*
*
*
2014-09-03 : 102 lightning strikes were recorded.
See if you can output the data with a more familiar date format:
(Hint: split the date and rearrange the elements)
04 10 2014 : 1 lightning strikes were recorded.
04 21 2014 : 19 lightning strikes were recorded.
Please use the following above code and comments to write this code
File sample :
DAY,CENTERLAT,CENTERLON,FCOUNT
2015-04-10,42.7,-73.8,1
2015-04-21,42.7,-73.8,19
2015-05-10,42.7,-73.8,1
2015-05-27,42.7,-73.8,7
2015-05-30,42.7,-73.8,7
2015-06-09,42.7,-73.8,99
2015-06-12,42.7,-73.8,34
2015-06-13,42.7,-73.8,276
2015-06-23,42.7,-73.8,5
2015-07-19,42.7,-73.8,110
2015-08-03,42.7,-73.8,62
2015-08-04,42.7,-73.8,3
2015-08-11,42.7,-73.8,3
2015-08-15,42.7,-73.8,45
2015-09-03,42.7,-73.8,102
The code needs to be as simple as possible using the above example code as reference. It cannot be code that we havent covered in class. so no import, def load
hey here is solution to your problem.
#opening csv file
with open("file.txt", "r") as ins:
# lines array to store all the lines of
file
lines = []
# now looping through each line
for line in ins:
#appending each line to the lines
array with removing last char of each line
#because its a "\n" newline char
which isnot needed
lines.append(line[:-1])
# now looping through each line in lines array to print the
output
for i in lines:
# splitting each line by "," delimeter so we get
seperated arraylist of elements
temp=i.split(",")
#data inside temp ['2015-07-19', '42.7', '-73.8',
'110']
count_of_lightning=temp[3]
#splitting the date attribute so we can reshuflle date
to year month date to month date year format
temp_date=temp[0].split("-")
# ['2015', '09', '03'] data inside temp_Date
variable
# set date as "month date year"
#printing final output
# month date year lightning count
print (temp_date[1]+" "+temp_date[2 ]+"
"+temp_date[0]+ " : "+count_of_lightning + " lightning strikes were
recorded.")
In case of any doubt please comment. Happy Learning :)

Using python beginner code see example code of what to use for this assignment we have...
The code should work exactly the same as given example.
The files:
----------------------------------------------------------------------------------------------------
-------- FILE NAME -------
album0
---------- FILE -------
<album>
323
Licensed to Ill
Beastie Boys
25.0
</album>
<album>
70
Enter the Wu_Tang: 36 Cham...
Wu Tang Clan
25.99
</album>
turning to Alice, she went on, `What's your name, child?'
and there stood the Queen in front of them, with her arms
folded,
<album>
115
Daydream Nation
Sonic Youth
5.0
</album>
<album>
414
52nd Street
Billy Joel
25.75...
Need help with C++ assignment
Assignment 1 and .txt files are provided at the
bottom.
PART A
PART B
Assignment
1
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <algorithm>
using namespace std;
/**
This structure is to store the date and it has three integer
fields
**/
struct Date{
int day;
int month;
int year;
};
/**
This structure is to store the size of the box and it...
C++ Need help with this code. Can't use "using namespace std;" Control break report Objectives Read data from a text file Write data to a text file Correctly end a file input loop when end of file is reached Process control breaks correctly Calculate sums for grouping of input data Implement an algorithm Format output data on a report neatly Test and debug a program Overview This assignment involves the creation of a level break report. The data file provided...
The purpose of this lab assignment is to practice searching in Unix and using regular expressions. Task A: Use the find command to find all directories under /pub/cs/ whose name is cs160a. Be sure to only display the results that match, do not display any error output. Hint: use: 2>/dev/null. Task B: Create a one-line command, using he famous.dat file, to add the word " STREET" to the address, for all who live on 2nd or 3rd. For example: '2nd'...
Python program This assignment requires you to write a single large program. I have broken it into two parts below as a suggestion for how to approach writing the code. Please turn in one program file. Sentiment Analysis is a Big Data problem which seeks to determine the general attitude of a writer given some text they have written. For instance, we would like to have a program that could look at the text "The film was a breath of...
****PLEASE CODE IN C++ and line doc explaining what is happening!***** **HERE IS THE INPUT FILE(.txt)***** Ottawa Senators New York Rangers Boston Bruins Montreal Canadiens Montreal Canadiens Toronto Maple Leafs New York Rangers Chicago Blackhawks Montreal Maroons Detroit Red Wings Detroit Red Wings Chicago Blackhawks Boston Bruins New York Rangers Boston Bruins Toronto Maple Leafs Detroit Red Wings Montreal Canadiens Toronto Maple Leafs Montreal Canadiens Toronto Maple Leafs Toronto Maple Leafs Toronto Maple Leafs Detroit Red Wings Toronto Maple Leafs...