Python Forum
short_str in long_str
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
short_str in long_str
#1
I'm following tutorial and one of the problems to solve is this one:
1. [ ] get user input for a single word describing something that can be read save in a variable called can_read
e.g. - "website", "newspaper", "blog", "textbook"
2. [ ] get user input for 3 things can be read
save in a variable called can_read_things
3. [ ] print true if the can_read string is found
in the can_read_things string variable

can_read = input("add1: ")
can_read_things = input("add3: ")
print(can_read_things.find(can_read))
I wrote this code with add1 = book and add3 = book notebook textbook but when I run the code receive outcome 0. Help is appreciated.
Reply


Messages In This Thread
short_str in long_str - by Truman - Jan-08-2018, 12:46 AM
RE: short_str in long_str - by squenson - Jan-08-2018, 06:28 AM
RE: short_str in long_str - by Truman - Jan-08-2018, 09:49 PM
RE: short_str in long_str - by buran - Jan-08-2018, 09:46 AM
RE: short_str in long_str - by buran - Jan-08-2018, 10:08 PM
RE: short_str in long_str - by nilamo - Jan-08-2018, 10:12 PM
RE: short_str in long_str - by Truman - Jan-08-2018, 10:31 PM
RE: short_str in long_str - by squenson - Jan-08-2018, 10:49 PM
RE: short_str in long_str - by Gribouillis - Jan-08-2018, 11:38 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020