Question: 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

functions and loop help,python Sevens.py Submit Run Grade 1 # rite afunctions 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!