
OUTPUT :
![RESTART: D:/Coding/PYTHON/save history.py >>> save history (I[1,2],13,41,15, 611,15) RESTART: D:/Coding/PYTHON/save history.p](http://img.homeworklib.com/questions/8df6c640-1780-11ec-abba-59a9bf13c017.png?x-oss-process=image/resize,w_560)
CODE :
def save_history(nl,a):
#Form the file name
name = 'Landing'
if a<10:
name =
name+'0'+str(a)+'.csv'
else:
name =
name+str(a)+'.csv'
#Length of the list
s = len(nl)
f = open(name,'w')
#Write the list length
f.write(str(s)+'\n')
#For all the lists, add it to the file
for lst in nl:
f.write(','.join([str(x)
for x in lst])+'\n')
f.flush()
f.close()
Python Language ! Use the Design Recipe to define a function save_history which consumes two parameters,...
CODE IN PYTHON 17. Use the Design Recipe to define a function called black_jack which consumes to 2 int values greater than 0. Return whichever value is nearest to 21 without going over. Return 0 if they both go over. Include a docstring! Write three assertEqual statements to test your function.
Python Language
The Blip Blob New Year celebration started on a Tuesday. Use the Design Recipe to write a function called blip_blop_day that consumes an int representing the number of days that have passed since their celebration start day and returns name of the current day. For example, if 2 days have passed, then 'Thursday' should be returned. Include a docstring! For example: Test Result 2 Thursday 4 Saturday Monday Tuesday 6 7 8 Wednesday
Problem 20 [ 2 points ] Use the Design Recipe to write a function, print_histogram that consumes a list of numbers and prints a histogram graph using asterisks to represent each number in the list. Use one output line per number in the list. You may assume that only integers are passed to this function. Your function should ignore negative values. Include a docstring! Test Result print_histogram([ 0, 2, 4, 1]) ** **** * print_histogram([10, 5, 3, -1, 8]) **********...
I am stuck with this coding problem from edx coding python 4.4.6: #This is a long one -- our answer is 20 lines of code, but #yours will probably be longer. That's because it's one of the #more authentic problems we've done so far. This is a real #problem you'll start to face if you want to start creating #useful programs. # #One of the reasons that filetypes work is that everyone #agrees how they are structured. A ".png" file,...
PYTHON PROGRAMMING LANGUAGE (NEEDED ASAP)
Using a structured approach to writing the program: This section will guide you in starting the program in a methodical way. The program will display a window with GUI widgets that are associated with particular functions: Employee Payroll O X -- - - - - - - - - - - Show Payroll Find Employee by Name Highest Lowest Find Employee by Amount Write Output to Fie Cancel - -------- ------------- Notice that some of...
Question A matrix of dimensions m × n (an m-by-n matrix) is an ordered collection of m × n elements. which are called eernents (or components). The elements of an (m × n)-dimensional matrix A are denoted as a,, where 1im and1 S, symbolically, written as, A-a(1,1) S (i.j) S(m, ). Written in the familiar notation: 01,1 am Gm,n A3×3matrix The horizontal and vertical lines of entries in a matrix are called rows and columns, respectively A matrix with the...
You need not run Python programs on a computer in solving the following problems. Place your answers into separate "text" files using the names indicated on each problem. Please create your text files using the same text editor that you use for your .py files. Answer submitted in another file format such as .doc, .pages, .rtf, or.pdf will lose least one point per problem! [1] 3 points Use file math.txt What is the precise output from the following code? bar...