1. Implement a Command Interpreteron apollo for the following commands. Note that each command follows a different pattern:
d. sumsqnum1 num2 num3 ....
Squares each number sums the result. Returns the sum and the square root of the sum as output. The numbers should be converted from their string values to doubles to do the calculation. If no numbers are listed result should be 0.0 0.0.
e. time timeformat
The example provided returns the current time in Japan. This command should return the current time in the specified format In CENG 151 you learned to display the time in using different format codes using the -d flag. Use the C function timeto retrieve the current tim
total_number=int(input("Enter the total number of terms"))
num=[]
square=[]
sum=0
for i in range(total_number):
num.append(input('Enter the terms'))
square.append(int(num[i])*int(num[i]))
sum=sum+int(square[i])
print(num)
print(square)
print(sum)
import pytz
import datetime
a = datetime.datetime.now() # UTC
b = datetime.datetime.now(tz=pytz.timezone('Asia/Tokyo')) # for Japan time zone
if(input('datetime')=='datetime'):
print('Date time (UTC):',a)
print('Date time (Japan time zone):',b)
else:
print('no such command found')
Comments
Leave a comment