Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q4. Write a function named 'printEvens' that accepts 2 integers 'a' and 'b' and creates and returns an array such that all numbers between a

Q4. Write a function named 'printEvens' that accepts 2 integers 'a' and 'b' and

creates and returns an array such that all numbers between a and b (inclusive) contain

only even digits (0 is considered even)!

For example, printEvens(433, 452) would create and return a new list with the following

values: [440, 442, 444, 446, 448]

NOTE: EACH and EVERY digit MUST be an EVEN number, NOT simply that the entire

number itself be EVEN!

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( )

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

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions

Question

=+1 What makes a firm a transnational enterprise?

Answered: 1 week ago