Answer to Question #242203 in Computer Networks for hussain

Question #242203

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


1
Expert's answer
2021-09-27T06:17:28-0400
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')

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS