python 3.7.2 for language
good variable names
please comment for each line of code
Answer 1) "%A" would be the placeholder.
Program:
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 27 04:01:15 2018
@author:
"""
import csv
import datetime
with open('ShopRecords.csv') as csvfile: #opening the file
readCSV = csv.reader(csvfile, delimiter=',')
lst = [] #empty list to hold the data
header=next(readCSV)
for row in readCSV:
month, day, year = (int(x) for x in row[2].split('/')) #split the
date
day=datetime.date(year, month, day).strftime('%A') #getting week
day
lst.append([row[1],day]) #appending item and day to the list
for row in lst:
if row[1] in ('Saturday','Sunday'): #checking items sold on
weekends
print(row[0])
Code and Output:
weelkends.py temp.py 1# -*- coding: utf-8 -*- 3 Created on Thu Sep 27 84:01:15 2018 4 author: 6 import csv 7 import datetime 8 with open( 'ShopRecords.csv.) as csvfile : #opening the file 9 readCSV-csv.reader (csvfile, delimiter-',') 10 11 12 1st [] #empty list to hold the data header-next(readCSv) for row in readcSV: month, day, year- (int(x) for x in row[2]. split('/')) #split the date day-datetime. date (year, month, day), strftime (%A') #getting week day 1st.append([row[1],day]) #appending item and day to the list 15 17 for row in lst: if row[1] in ('Saturday' ,'Sunday'): #checking items sold on weekends 19 20 21 print(row[])
python 3.7.2 for language good variable names please comment for each line of code 1. Answer...
Python 3.7.2 for language Please comment for each line of code good naming is important 1. Answer the question: what is the Python regular expression pattern that would match a hex color (https://en.wikipedia.org/wiki/Web_colors ) (for example, the pattern that would match an email address is '[\w.-]+@[\w.-]') Write an algorithm for step 3. As part of your algorithm, be sure to describe the pattern you're using to find the win/loss result for each game. Write a program that looks at the...
You have this solution in Java, I am interested in this same solution for Python.One interesting application of two-dimensional arrays is magic squares. A magic square is a square matrix in which the sum of every row, every column, and bothdiagonals is the same. Magic squares have been studied for many years, and there are some particularly famous magic squares. In this exercise you will write code todetermine whether a square is magic.You should find that the first, second, and...
Which of the following frequency tables shows a skewed data set? Select all that apply: Value Frequency 5 2 6 5 7 3 8 15 9 11 10 24 11 14 12 12 13 10 14 4 Value Frequency 13 2 14 5 15 14 16 13 17 23 18 26 19 15 20 2 Value Frequency 5 1 6 1 7 9 8 20 9 24 10 20 11 6 12 11 13 5 14 2 15 1 Value...
Date DLT Close ASX Index 28/12/14 0.145 5435.899902 4/1/15 0.135 5465.600098 11/1/15 0.1 5299.200195 18/1/15 0.097 5501.799805 25/1/15 0.098 5588.299805 1/2/15 0.082 5820.200195 8/2/15 0.072 5877.5 15/2/15 0.076 5881.5 22/2/15 0.1 5928.799805 1/3/15 0.14 5898.899902 8/3/15 0.135 5814.5 15/3/15 0.12 5975.5 22/3/15 0.1 5919.899902 29/3/15 0.1 5898.600098 5/4/15 0.1 5968.399902 12/4/15 0.091 5877.899902 19/4/15 0.115 5933.299805 26/4/15 0.11 5814.399902 3/5/15 0.215 5634.600098 10/5/15 0.22 5735.5 17/5/15 0.25 5664.700195 24/5/15 0.255 5777.200195 31/5/15 0.185 5498.5 7/6/15 0.195 5545.299805 14/6/15 0.18 5597...
Solve each inequality and graph its solution. 11) -12+ 3(-4 + 10x)2 3(1+ 10x)+5 12) 9-10k- 5k+ 62 5(9- 11k)+10(-7+4k) -10-8 -6 6 -5-43 -2 -1 01234 13) -5 +ks7 14) -4n> 8 4 2 0 2 468 10 12 14 7-6-5-4-3-2-1 01234 5 6 15) 6x+4 <4 16) 10p-9 s61 8 -7-6-4 -3-210 123 17) 3+-8x- 10 S-23 18) 4v-3-7>-26 6-5432-01234S 7-6-5432101 234
Part S: Compate fer each set of fractions 2 4 6 1 8+12- 2+7- 3 5 7 10-5-1 4 2 3 1 9 3 10 5- 7 2 3 3 5 3- 8 5- Part 6: Add and subtract the signed numbers. 8+18-(-3) -5-(-17) 42+ (-4) -12-(+26) 3+(-29)+ (-11) 0-(-16) +7 15-4+(-18) -54 +34 8+((41-(-17) -17-(-3+-1) 5-(16+-2) -33+(-5-6) Part 7: Multiply and divide the signed numbers (-4X-5)(20) (-2)(-7)-4) 13(-3)X2) 12+-3 -26/-13 (3(4X-1) -35+5 -84/-2 (11-3)3 6/3-2 (4 8)-1 (-30/10) -7
Python HELP How can a get the diagonals of an n x n list without using numpy. For example if have a list: L = [[1,2,3,4], [5,6,7,8], [9,10,11,12], [13,14,15,16] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Then I can get the diagonals: 1, 6, 11, 16 2, 7 , 12 3, 8 5 , 10 ,15 9, 14 2, 5 3, 6, 9 4, 7, 10, 13 8, 11, 14 12,...
Python HELP How can a get the diagonals of an n x n list without using numpy. For example if have a list: L = [[1,2,3,4], [5,6,7,8], [9,10,11,12], [13,14,15,16] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Then I can get the diagonals: 1, 6, 11, 16 2, 7 , 12 3, 8 5 , 10 ,15 9, 14 2, 5 3, 6, 9 4, 7, 10, 13 8, 11, 14 12,...
Game Point_Differential Assists Rebounds Turnovers Personal_Fouls 1 15 15 38 11 9 2 36 20 43 8 13 3 16 21 29 7 13 4 45 22 46 11 11 5 12 11 40 7 22 6 -10 10 31 13 26 7 11 19 45 11 7 8 12 16 32 16 14 9 3 16 27 18 15 10 19 9 34 17 17 11 40 16 41 9 17 12 44 12 29 9 22 13 16 ...
Problem 6. The set (Z19 − {0}, ·19) is a group with the indicated operation; see the attached table. a.) Show that H = {1, 7, 8, 11, 12, 18} is a subgroup. b.) List all the right cosets of H. c.) Show that if Hy = Hx then xy−1 ∈ H. [Make sure to give a reason for each step.] d.) Show that φ : H → Hx defined by φ(h) = hx is one-to-one and onto. [Use the...