Posts

Showing posts with the label Python Quiz 2

Python Quiz 2

 Python Quiz 2 Ques 1:  Given that now=datetime.now() , which call may produce different results on different computers? (a) print(now.strftime("%d")) (b) print(now.strftime("%Y")) (c) print(now.strftime("%M")) (d) print(now.strftime("%c")) Answer: Option(D):  print(now.strftime("%c") Ques 2:  Which code will you use to generate a date and time output in the following format? 13-Mar-2020 16:42:58 (a) from datetime import date          now=date.now()        print(now.strftime("%B-%D-%Y %H:%M:%S")) (b) from datetime  import datetime        now=datetime.now()        print(now.strftime("%d-%b-%Y %h:%m:%S")) (c) from datetime import datetime        now=datetime.now()        print(now.strftime("%d-%b-%Y %H:%M:%S")) (d) from datetime import datetime          print(datetime("%d-%B-%Y %H:%m:%S")) Answer: Option(C...