Answer:
import sys, time
from os import walk, remove
from os.path import exists, join, getsize, getctime
file_counter = [ ]
folder_name, file_size = argv
isExist = exists( folder_name )
if folder_name == True:
for root, folder, files in walk( folder_name ):
for file in files:
if getsize( join ( root, file ) ) >= file_size:
file_log = [ ]
file_log.append( file )
file_log.append( join ( root, file) )
file_log.append( time.ctime( getctime( file ) ) )
file_counter.append( file_log )
else:
remove ( join ( root, file ) )
Explanation:
The python script above output the filename, size and file creation date of any folder passed to it.
Answer:
The answer is "classes are the blueprints"
Explanation:
According to the class definition, it is a collection of data members and member methods, in which all the data members can't return any value, and member methods or functions return a value.
- In this question, the carpenter uses the blueprint to build the house, if he uses class and object model.
- This model also known as an entity blueprint, which sets the properties and functions with an object type.
Answer:
False is the correct answer for the above question.
Explanation:
- The structure is a user-defined data type, which is used to define the set of different data types and values. Just like in the above question, the class structure holds the list of three variables, which is a type of double.
- When any user wants to compare the two structure values, then he can do it with the help of comparing all the variables of a structure. if a user wants to compare the circle1 with the value of the circle2, then he needs to compare the circle1.centerX with circle2.centerX, and so on with the other variables.
- But the above question syntax will directly compare the two structure variable, which is not correct. Hence the above answer is false.
Answer:
count = 0
months = 0
years = int(input("Enter the number of years: "))
for year in range(1, years+1):
cars_sold = int(input("Enter the number of cars sold in first six months: "))
count += cars_sold
months += 6
print("Number of months: " + str(months))
print("Number of cars sold in total: " + str(count))
print("Average number of cars sold per month: " + str(count / months))
Explanation:
Initialize the variables
Ask the user for the number of years
Create a for loop that iterates depending on the given number of years
Ask the user for the number of cars sold in the first six months of the year
Increment the count by given number and increment the months by 6 after each iteration
Print the months, count and, average
CTRL/CMD + B (BOLD)
CTRL/CMD + U (Underline)
CTRL/CMD + ] or [ (change font size)