Question: using python 3 l Homework: List Comprehension, DateTime, Calendar Use LIST COMPREHENSION to create and PRINT a listOfDivByThree of all the numbers from 1-25 that
using python 3
l
Homework: List Comprehension, DateTime, Calendar
| Use LIST COMPREHENSION to create and PRINT a listOfDivByThree of all the numbers from 1-25 that are divisible by 3. Output should be: [3,6,9,12,15,18,21,24] |
|
| Use LIST COMPREHENSION to change a list of strings to integers. Assume that each string contains ONLY digits, and name the newly created list numList. Example: if strList = [10,20,30] numList should be [10,20,30] |
|
| Use LIST COMPREHENSION to extract only the capital letters from a sentence. Example: if sentence = This IS not a JOKE newList should be [T,I,S,J,O,K,E] |
|
| Use LIST COMPREHENSION to extract only the scores that are above the average of the scores in listScores. Ex: if listScores = [10,20,30,40,15,60] newList should be [30,40,60] |
|
| 5. Use LIST COMPREHENSION to create a list containing the letter grades for scores that are below 90.
|
|
lll
List Comprehension
DateTime, Calendar
| from datetime import * curDate = date.today() # Write Python to print the month, the day, and the year
|
|
| d1 = datetime(2017, 2, 1) d2 = date (2017, 1, 20) print(d1 d2) | What is the output? EXPLAIN! |
| Write Python to calculate the # of days youve been alive.
|
|
| from datetime import * from calendar import * print (monthrange(2017,1)) print(monthrange(2017,11)) print(monthcalendar(2017,11)) print(monthcalendar(2017, 10)) | What is the output EXPLAIN the results! |
| Write Python to ask the user to enter #s for the year, day and month. It should ensure that the day entered is valid for that month and year. Example: if the user entered 31 for days, 6 for month, and 2017 for year, it is invalid since June has only 30 days. |
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
