Help with 7.5 Code Practice: Question 2
Hi, I am having trouble on how to do the code practice on the knock knock joke.
Here's what I have:
# Saving filepath to a variable
# makes a smoother transition to the Sandbox
filepath = "KnockKnock.txt"
# When finished copy all code after this line into the Sandbox
# Open the file as read-only
inFile = open(filepath, "r")
# Get the first line and do something with it
line = inFile.readline()
# Write your program below
count = 0
inFile = open(filepath, "r")
while line:
count += 1
line = inFile.readline()
inFile.close()
print("Knock Knock")
print("Who's there?")
inFile = open(filepath, "r")
Sample Run from lesson
Sample Run
Note: the extra lines are there because each line ends in a \n and students will not know how to cut those off yet.)
Knock-Knock
Who's there?
Rabbit
Rabbit
who?
Rabbit up carefully it's a present!
Attachments:
Answers
Answered by
0
Answer:
what I am not sure
Explanation:
do to do do do for fun in brainly of the team and get back to you about the denominator
Similar questions