Posts

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):  f rom datetime import datetime now=datetime.now() print(now.strftime("%d-%b-%Y %H:%M:

Python Course Quiz 1

 Python Course Quiz 1 Ques 1: What is the best way to see which version of python3 is installed without running it? ·    (a)  python -version ·    (b)  python3 ·    (c)  python -v ·    (d)  python3 --version  Answer: Option(D )  python3 --version Ques 2:  When should you verify what the VS Code python.pythonPath setting is set to? ·   (a)  when you have multiple installations of Python on your computer ·   (b)  when the desired Python debugging extension fails to install ·   (c)  when the debugger does not default to your script's directory ·   (d)  when VS Code fails to load your Python script  Answer: Option(A):  when you have multiple installations of Python on your computer Ques 3:  What code should come instead of the ??? placeholders to have a function that takes the amount of local currency and a varying number of exchange rates, and prints the value of the currency at each provided exchange rate? def Calc(???):        for i in rates:            print(?