subject
Computers and Technology, 09.03.2020 17:20 maru91

Write a function called lucky_sevens that takes in one #parameter, a string variable named a_string. Your function #should return True if there are exactly three '7's in #a_string. If there are less than three or more than three #'7's, the function should return False.
For example:
# - lucky_sevens("happy777bday") should return True.
# - lucky_sevens("h7app7ybd7ay") should also return True.
# - lucky_sevens("happy77bday") should return False.
# - lucky_sevens("h777appy777bday") should also return False.
Hint: Remember in Chapter 3.3, we covered how to use a loop to look at each character in a string. #Write your function here!
Below are some lines of code that will test your function.
You can change the value of the variable(s) to test your function with different inputs.
If your function works correctly, this will originally #print: True, True, False, False, each on their own line.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:00
Duplicating objects creates copies that a. move differently than the original object b. erase the original object c. look and act like the original object d. add events to a game
Answers: 1
question
Computers and Technology, 22.06.2019 22:00
Perform the following tasks: a. create a class named testclass that holds a single private integer field and a public constructor. the only statement in the constructor is one that displays the message “constructing”. write a main()function that instantiates one object of the testclass. save the file as testclass.cpp in the chapter 08 folder. run the program and observe the results. b. write another main()function that instantiates an array of 10 testclass objects. save the file as test class array.c . run this program and observe the results.
Answers: 1
question
Computers and Technology, 23.06.2019 16:30
Which of the following is not an enhancement to the standard wiki to make it more attractive for corporations? encryptionwork spacespermission toolspredictive text
Answers: 2
question
Computers and Technology, 23.06.2019 17:00
What are the 12 colors of the spectrum called?
Answers: 1
You know the right answer?
Write a function called lucky_sevens that takes in one #parameter, a string variable named a_string....
Questions
question
Mathematics, 24.03.2021 03:50
question
Mathematics, 24.03.2021 03:50
question
Mathematics, 24.03.2021 03:50
question
Mathematics, 24.03.2021 03:50
Questions on the website: 13722362