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, 21.06.2019 17:10
3. consider the following class definitions: class smart class supersmart: public smart { { public: public: void print() const; void print() const; void set(int, int); void set(int, int, int); int sum(); int manipulate(); smart(); supersmart(); smart(int, int); supersmart(int, int, int); private: private: int x; int z; int y; int secret(); }; }; . which private members, if any, of smart are public members of supersmart? a. which members, functions, and/or data of the class smart are directly accessible in class supersmart?
Answers: 2
question
Computers and Technology, 22.06.2019 11:20
The kurt vonnegut commencement speech, the neiman-marcus chocolate chip cookie recipe, and the get-well emails to the dying boy are examples of select one: a. social engineering b. hoax emails c. email viruses d. worms
Answers: 1
question
Computers and Technology, 23.06.2019 15:30
Brian wants to conduct an online search with a certain phrase. he intends to use the words books that belong to the 1800s in his search. how should he use the word that in his search?
Answers: 1
question
Computers and Technology, 24.06.2019 00:50
3. what is the output of the following statements? temporary object1; temporary object2("rectangle", 8.5, 5); temporary object3("circle", 6, 0); temporary object4("cylinder", 6, 3.5); cout < < fixed < < showpoint < < setprecision(2); object1.print(); object2.print(); object3.print(); object4.print(); object1.set("sphere", 4.5, 0); object1.print();
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, 19.08.2019 14:00
question
Mathematics, 19.08.2019 14:00
question
Mathematics, 19.08.2019 14:00
Questions on the website: 13722360