0

The last task in the python for beginners, help. Just to finish a course I don't understand

In the course python for beginners, I came to the last task. But I did not understand half of the submitted material, unfortunately. I returned to the study of incomprehensible paragraphs yet, but in vain.

6th Aug 2021, 9:42 AM
Taras Ishchuk
Taras Ishchuk - avatar
7 Respostas
+ 5
Taras Ishchuk The details provided are the challenge description. Please attach your attempt so we may guide you
6th Aug 2021, 10:28 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 8
Taras Ishchuk , please show us your attempt first. put your code in playground and link it here. without having seen your code it would be difficult to find out the issues you have. thanks!
6th Aug 2021, 9:50 AM
Lothar
Lothar - avatar
+ 3
Taras Ishchuk create a function "search" with two arguments "text" and "word" and use if else block to check word is present or not in the text Example : text="Hello world".lower() word="hello" if word in text: print("Word Found") else: print("Word is not Found!") this is just an hint for you and not the actual answer !
6th Aug 2021, 11:18 AM
Ratnapal Shende
Ratnapal Shende - avatar
+ 2
Taras Ishchuk How about this one? :- def search(text, word): return "Word" + " not" * (word not in text) + " found" print(search(input(), input())) # Hope this helps
6th Aug 2021, 7:35 PM
Calvin Thomas
Calvin Thomas - avatar
+ 1
Taras Ishchuk Your code syntax was good but you did not place it inside a search() function as per challenge details. Also your output must exactly match the output specified by the challenge. # Create a function def search(txt, wrd): if wrd in txt: print("Word found") else: print("Word not found!") # Your inputs here text = "Hello World".lower() word = "hello" # Call your function search(text,word)
6th Aug 2021, 10:33 PM
Rik Wittkopp
Rik Wittkopp - avatar
0
You are working on a search engine. Watch out for Google! This code takes text and word as input and passes them to a function named search (). The search () function should return "Word found" if the word is present in the text or "Word not found" if not present. Sample Input Data "This is awesome" "awesome" Sample Output Data Word found
6th Aug 2021, 9:44 AM
Taras Ishchuk
Taras Ishchuk - avatar
0
text="Hello world".lower() word="hello" if word in text: print("Word Found") else: print("Word is not Found!")
6th Aug 2021, 11:56 AM
Taras Ishchuk
Taras Ishchuk - avatar