PYTHON: Write a code that prints out the current time in hrs:mins:secs. You need to import the time module (import time). The function time.time() yields the time in seconds since Jan 1, 12 am, 1970; i.e., it yields what is known as the epoch time (GMT). Convert to Pacific Standard time.
The answer to the question is given below.
The python code is given below.
#package for datetime and timezone
from datetime import datetime
from pytz import timezone
#getting currnet time
now=datetime.now()
#strftime function formats the string
t=now.strftime("%H:%M:%S")
print("UTC Time: ")
#printing the UTC Time
print(t)
#Changing the timezone from UTC to US/Pacific
now=now.astimezone(timezone('US/Pacific'))
t=now.strftime("%H:%M:%S")
print("Pacific Standard Time:")
print(t)
The screenshot of the running code is given below.

The screenshot of the output is given below.

If the answer helped please upvote it means a lot. For any query
please comment.
PYTHON: Write a code that prints out the current time in hrs:mins:secs. You need to import...
python rephactor 1. Write code that prints the square root of the value in the variable num rounded to 4 decimal places. Assume that num already has a value and that the math module has been imported. 2. Write a function called ordinal_sum that accepts a string argument and returns the sum of the ordinal values of each character in the string. The ordinal value of a character is its numeric Unicode code point in decimal.
Exercise 2: Import a Python Math Module You can find a list of all of the math functions available in the Python.org Math Functions page found in the Resources. Select any math function(s) that you would like to use in a program. Do the following: Write a program that imports the math module and uses the function that you selected. (Hint: You will need to determine the arguments that must be passed to the function, return the result, and display...
python 3 please, for these questions you do not need to write the whole code just the expression 1)Write a loop that reads positive integers from standard input, printing out those values that are greater than 100, each on a separate line, The loop terminates when it reads an integer that is not positive. 2) Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive. After the loop...
This problem demonstrates the use of import module. The Python programming language has many strengths, but one of its best is the availability to use many existing modules for various tasks, and you do not need to be an experienced computer programmer to start using these modules. We have given you some incomplete code; note that the very first line of that code contains an import statement as follows: import math This statement enables your program to use a math...
Greeter Write a function that takes in a person's name, and prints out a greeting. The greeting must be at least three lines, and the person's name must be in each line. example: Hello name How are you do name Nice to meet you name Use your function to greet at least three different people. Full Names Write a function that takes in a first name and a last name, and prints out a nicely formatted full name, in a...
Write a python code that takes in an number 0-9 and prints out the word of the number. For example 1 would print out one. Below is the skeleton of the code that needs to be filled in. def num2string(num): """ Takes as input a number, num, and returns the corresponding name as a string. Examples: num2string(0) returns "zero", num2string(1)returns "one" Assumes that input is an integer ranging from 0 to 9 """ numString = "" ################################### ### FILL IN...
Write the python function time to midnight() that takes the name of a file containing multiple lines of text giving time in HH:MM:SS HRS or HH:MM:SS AM or HH:MM:SS PM format one per line. The HRS notation indicates CSE 101 – Summer 2019 Lab Assignment #9 2 that the time has been given in 24-hour time format. Each line tells the current time of the day. The function reads the file line by line and calculates the number of seconds...
Write a function to dump the html content, and save it in the same directory of your python script. The name of the saved html file should include the current time stamp. I currently have been trying this code. But Repl.it says "ModuleNotFoundError: No module named 'urllib2'". Could someone point out what i am doing wrong and help me include the current time stamp using 'datetime'. The format for the date and time should be YYYY_MM_DD_HH_MM_SS. import urllib2 def webpagedumb(url):...
Write a Python Code for a Function: you need to come up with code for shift_char. Write the code in a way in which you can shift the character by writing the number of shifts. Use the ASCII code for this. For example in lie 11, the input for char_to shift is r. U shift it by 1 so it becomes s. below is the function def shift_char(char_to_shift, amount_to_shift): ''' shifts any character by moving it a certain amount on...
I need help with my python class. thanks! Question 12 Code Example 4-4 main program: import arithmetic as a def multiply(num1, num2): product = num1 * num2 result = a.add(product, product) return result def main(): num1 = 4 num2 = 3 answer = multiply(num1, num2) print("The answer is", answer) if __name__ == "__main__": main() arithmetic module: def add(x, y): z = x + y return z Refer to Code...