- 3
Help me solve that code project
in python core course there is a project call (Book titles) i can't solve it please help me
12 Answers
+ 4
So in this challenge you need to read through the file. The file is opened for you in the starter code. You can use a for in loop to read the file. For each line print the first character of the title using [0] syntax. Then print the length of the title len(). You can use .replace to get rid of the newline replace \n with "" Don't forget to close the file.
+ 8
Post your attempt here so we can help
+ 6
Post your attempt here. So we can try to know where is the problem
+ 4
Post your attempt (code) here so we can coach you.
+ 3
str(len(line.replace("\n", "")))
+ 2
If yes, the the code would be like this:
result= 0.01 * 2**30
print(result)
That mean we are doubling the initial value (.01) 30 times.
+ 2
Morteza Hajji thanks alot for your answer but the project isn't about Exponentiation
+ 2
Paul K Sadler
Now it works thank you
But i didn't understand how to get ride of the newline
The code still include the newline in len()
+ 1
https://www.sololearn.com/learning/eom-project/1073/353
this is the project link
+ 1
By this link just the general python course opened. you mean projec part basic? Exponentiation?
0
Paul K Sadler now it works 🙏
Thanks so much
0
#Program to check if word appears on sentence text.
text = input()
word = input()
j = "Word found"
k = "Word not found"
def search(text, word):
for i in text:
if text == i:
return j
else:
return k
print(search(text, word))
#hi folks this is the final project on Python for beginners, it is a basic search engine, my code only outputs correct results 3 out of 6 times, can you please help me , I am almost done🙏🏽