Professional: Using social media to advertise a company you created
Unprofessional: Using social media to watch cat videos
Answer:
Explanation:
The following code is written in Python. It prompts the user for the name and age, saves them to their own variables. Then it creates and calculates the dogAge variable. Finally, it combines all of this information and prints out the statement.
name = input("Enter your name: ")
age = input("Enter your age: ")
dogAge = int(age) * 7
print("Your name is", name, "and in dog years you are", dogAge, "years old.")
<span>1 X 25 + 1 X 24 + 1 X 23 + 0 X 22 + 1 X 21 + 1 X 20 thus your Answer is C</span>
Answer:
In Python:
import os.path
from os import path
fname = input("Filename: ")
if path.exists(fname):
with open(fname) as file_in:
lines = []
for line in file_in:
lines.append(line.rstrip('\n'))
f = open("stat.txt","r+")
f.truncate(0)
f = open("stat.txt", "a")
f.write("Names\tTotal\tSubjects\tAverage\n")
for i in range(len(lines)):
rowsum = 0; count = 0
nm = lines[i].split()
for j in nm:
if (j.isdecimal()):
count+=1
rowsum+=int(j)
average = rowsum/count
f.write(nm[0]+"\t %3d\t %2d\t\t %.2f\n" % (rowsum, count, average))
f.close()
else:
print("File does not exist")
Explanation:
See attachment for explanation where comments were used to explain each line