Take this one step at a time. Your teacher has given you the code for step 1. Now write step 2. Then 3, and so on.
For step 2: if you're using Python v2.x you'd use a line like
guess = int( raw_input( "Take another guess: " ) )
For Python v3.x it would be:
guess = int( input( "Take another guess: " ) )
Break it down into small pieces, it's not a complicated assignment.
A Business letter
6ix9ine
No it is not. it's quite simple when you get the hang of it
Answer:
see explaination
Explanation:
# python code filereader.py
import sys
import readline
from sys import stdin
import random
## Open the file with read only permit
f = open('inputfile.txt')
## Read the first line
sum = 0.0
count = 0
#read file till the file is empty
while True:
line = f.readline()
if ("" == line):
print "Average age of friends is", sum/count
break
list = line.split()
print "My friend ",list[0], " is", list[1]
sum = sum + int(list[1])
count = count + 1
f.close()
'''
inputfile.txt
Denny 24
Penny 28
Lenny 20
Jenny 24
output:
My friend Denny is 24
My friend Penny is 28
My friend Lenny is 20
My friend Jenny is 24
Average age of friends is 24.0
see screenshot at attachment