Question

I need help with this question. The code will be written in pycharm and the function shouldn't change. Thanks!

Assignment objective This lab will give you additional practice with string processing and also introduce you to working with tuples. Getting started For the labs and homework assignments in this course you will be writing functions that solve computational problems. To help you get started on each assignment, we will give you on Piazza a bare bones file with a name like lab6.py. These files will contain function stubs and a few tests you can try out to see if your code seems to be correct. Stubs are functions that have no bodies (or have very minimal bodies). You will fill in the bodies of these functions for the assignments. Do not, under any circumstance, change the names of the functions or their parameter lists. The automated grading system will be looking for exactly those functions provided in lab6.py.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

def reformat_date(date):
s = ""
values = date.split("/")
month = int(values[0])
day = int(values[1])
year = int(values[2])
year = year % 100
if day < 10:
s = s + "0" + str(day) + "-"
else:
s = s + str(day) + "-"
if month == 1:
s = s + "JAN" +"-"
elif month == 2:
s = s + "FEB" +"-"
elif month == 3:
s = s + "MAR" +"-"
elif month == 4:
s = s + "APR" +"-"
elif month == 5:
s = s + "MAY" +"-"
elif month == 6:
s = s + "JUN" +"-"
elif month == 7:
s = s + "JUL" +"-"
elif month == 8:
s = s + "AUG" +"-"
elif month == 9:
s = s + "SEP" +"-"
elif month == 10:
s = s + "OCT" +"-"
elif month == 11:
s = s + "NOV" +"-"
elif month == 12:
s = s + "DEC" +"-"
if year < 9:
s = s +"0"+str(year)
else:
s =s+str(year)
return s;
  
  
  
print(reformat_date('5/17/2021'))
print(reformat_date('12/31/2000'))
print(reformat_date('9/8/2017'))

Output:

sh-4.3$ python3 main.py                                                                                                                                                                                                                                                

17-MAY-21                                                                                                                                                                                                                                                              

31-DEC-00                                                                                                                                                                                                                                                              

08-SEP-17

1 def reformat_date(date): 2 values-date.split(/) month int(values [0]) day-int (values [1]) year -int (values[2]) year -ye

Add a comment
Know the answer?
Add Answer to:
I need help with this question. The code will be written in pycharm and the function...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Need code written for a java eclipse program that will follow the skeleton code. Exams and...

    Need code written for a java eclipse program that will follow the skeleton code. Exams and assignments are weighted You will design a Java grade calculator for this assignment. A user should be able to calculate her/his letter grade in COMS/MIS 207 by inputting their scores obtained on worksheets, assignments and exams into the program. A skeleton code named GradeCompute.java containing the main method and stubs for a few other methods, is provided to you. You must not modify/make changes...

  • Please I need help with MATLAB .. PLease help me . Thankyou Write Matlab code to...

    Please I need help with MATLAB .. PLease help me . Thankyou Write Matlab code to plot a 2D sinc function over a 2D cartesian grid where x ranges from 100 to 355 and y ranges from 0 to 255 and the sinc is centered at somewhere not midway in the grid. First plot the grid, and then plot the function on the grid (both as grayscale and as a surface plot). Comment the code well, generate the figures and...

  • Hello, I need help with these two functions blockPrint and wordPrint.The program is written in C....

    Hello, I need help with these two functions blockPrint and wordPrint.The program is written in C. Thank you. ent the prototype for blockPrint. a) Intextfunctions.h, uncon Write the function definition for block Print dentical characters on a separate line. (See example This function should print each group (block) of ident output below) Example: Example: Incoming string: "Tbeehiklssuy Output (to the screen): Incoming string: "Java Programming Output to the screen: ee POOH da al Edit vour main function.include test calls and...

  • I need help writing c++ code to make this program. 1. Define a function that can...

    I need help writing c++ code to make this program. 1. Define a function that can read the input file answers.dat. This function should not print anything. 2. Define a function that computes the quiz score of the function by comparing the correct answers to the student’s answer. The result should be a percentage between 0 and 100, not a value between 0 and 1. This function should not print anything. 3. Define a function that prints the report as...

  • Would someone help me with the last 3 questions here, I got the previous ones but need help with the last 3 in red. Than...

    Would someone help me with the last 3 questions here, I got the previous ones but need help with the last 3 in red. Thank you Transcribed: Now that you nd a rst order system of ODEs, you can solve it using the Huens method ac- cording to the material you covered in computational module 2. A template of the code which will help you to get started is also available. Attach the complete code as a pdf page to...

  • i need help with (b) and (c)!!! thank u!!!! Jeanette has the following utility function: U= a*In(x) + b*In(y), where...

    i need help with (b) and (c)!!! thank u!!!! Jeanette has the following utility function: U= a*In(x) + b*In(y), where a+b=1 a) For a given amount of income I, and prices Px. Py, find Jeanette's Marshallian demand functions for X and Y and her indirect utility function. (6 points) b) From now on, you can use the fact that the utility parameters are a=0.2 and b=0.8. Find the Hicksian demand functions and the corresponding expenditure function. (6 points) c) Suppose...

  • Hi, I need some help finishing the last part of this Python 1 code. The last...

    Hi, I need some help finishing the last part of this Python 1 code. The last few functions are incomplete. Thank you. The instructions were: The program has three functions in it. I’ve written all of break_into_list_of_words()--DO NOT CHANGE THIS ONE. All it does is break the very long poem into a list of individual words. Some of what it's doing will not make much sense to you until we get to the strings chapter, and that's fine--that's part of...

  • i need help with this homework web page and i need the code too Using the "do while" or the "for" contr...

    i need help with this homework web page and i need the code too Using the "do while" or the "for" control statements, have a visitor to your Web page do, or see, something repeatedly. You could have him or her enter a number of months, an interest-rate, and an amount, and print out a table with the amount on deposit. Try to make the loop appropriate to the website theme that you have picked. Use a function in your...

  • I need help with my homework assignment Linux systems keep user account information in the passwd...

    I need help with my homework assignment Linux systems keep user account information in the passwd file and the encrypted password in the shadow file. The passwd file containing account information might look like this: smithj:x:1001:1001:John Smith:/home/smithj:/bin/bash The shadow file containing password and account expiration information for users might look like this: smithj:KJDKKkkLLjjwlnttqoiybnm.:10063:0:99999:7::: The fields in the shadow file are separated by a colon, with the first field being the username and the second being the password. Under normal circumstances,...

  • I need help with this assignment on Boolean Expression: Create a truth table for this function:...

    I need help with this assignment on Boolean Expression: Create a truth table for this function: F(a, b, c, d) = A'B'D + A'B + ACD Then use a K-Map to reduce the given function and create a truth table for the reduced funtion also(give detail Explanation) Please Implement both original function and the reduce function using logic gates on a multisim Note that the outputs should track if the circuits are designed and implemented correctly. Thank you

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT