Question: import math import random import string import collections import datetime import re import time import copy # YOUR CODE BELOW... def checkRegex(str2) : your code
import math
import random
import string
import collections
import datetime
import re
import time
import copy
# YOUR CODE BELOW...
def checkRegex(str2) :
your code here...
# end def
def fancyList(table, cityFrom, cityTo) :
your code here...
# end def
def natureSequence(fn, sn, n) :
your code here...
# end def
def printEvens(a, b) :
your code here...
# end def
def generatePokerHand(deck, coords) :
your code here...
# end def
def main( ) :
rv = checkRegex("abcdefghijklmnopqrstuvwxyz")
print(rv)
rv = checkRegex("Mariner!")
print(rv)
rv = checkRegex("acdefGhij*012345")
print(rv)
fancyList( )
rv = natureSequence(0, 1, 10)
rv = natureSequence(1, 3, 15)
printEvens(433, 452)
printEvens(2048, 2188)
deck = [["2C", "3C", "4C", "5C", "6C", "7C", "8C", "9C", "XC", "JC", "QC", "KC","AC"],
["2D", "3D", "4D", "5D", "6D", "7D", "8D", "9D", "XD", "JD", "QD", "KD", "AD"],
["2H", "3H", "4H", "5H", "6H", "7H", "8H", "9H", "XH", "JH", "QH", "KH", "AH"],
["2S", "3S", "4S", "5S", "6S", "7S", "8S", "9S", "XS", "JS", "QS", "KS", "AS"]
]
coords=["22", "0A", "38", "1B", "25"]
rv = generatePokerHand(deck, coords)
coords=["23", "24", "25", "26", "27"]
rv = generatePokerHand(deck, coords)
# end main( )
if __name__ == "__main__" :
main( )
Q3. Write a function named 'natureSequence' that returns a floating point value
and accepts 3 integer values: 'fn', 'sn', and 'n'
and displays 'n' number of terms in a sequence where the first term is 'fn',
the second term is 'sn', and all subsequent terms are computed from the sum
of the 2 previous terms.
The function returns the value of the last term divided by the 2nd last term.
All terms are separated by a space EXCEPT that there is NO SPACE after
the last term. A new line is output before the function ends.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
