Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

functions and loop help,python Sevens.py Submit Run Grade 1 # rite a function called lucky. Sevens that takes in one Console output will be displayed

image text in transcribedfunctions and loop help,python

Sevens.py Submit Run Grade 1 # rite a function called lucky. Sevens that takes in one Console output will be displayed here 2 #parameter, a string variable named a-string. Your function 3 #should return True if there are exactly three '7's in 4 #a string. If there are less than three or more than three 5 7's, the function should return False 6# 7 #For example: 8 # -lucky-sevens ("happy777bday") should return True 9lucky sevens("h7app7ybd7ay" should also return True 10 # -lucky-sevens( "happy77bday") should return False 11 # -lucky-sevens( "h777appy777bday") should also return False 12 # 13 #Hint: Remember in Chapter 3.3, we covered how to use a loop 14 #to look at each character in a string 15 16 17 # rite your function here! 18 def lucky sevens (a string): 19 20 21 22 #Below are some lines of code that will 23 #You can change the value of the variable(s) to test your 24 #function with different inputs 25 # 26#If your function works correctly, this will originally 27 #print: True, True, False, False, each on their own line 28 print(lucky_ sevens ("happy777bday 29 print 30 print (lucky_sevens ("happy77bday")) 31 print (lucky_sevens("h777appy777bday")) 32 test your function ucky_sevens "h7appZybd7ay" 34

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Evaluate the importance of the employee handbook.

Answered: 1 week ago

Question

Discuss the steps in the progressive discipline approach.

Answered: 1 week ago