Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

USE SIMPLE PYTHON LANGUAGE (do not import libraries) and share ScreenShot of pytest and code # Given two triples of numbers that represent birthdays as

USE SIMPLE PYTHON LANGUAGE (do not import libraries) and share ScreenShot of pytest and code
# Given two triples of numbers that represent birthdays as (day, month, year), return True if and only if the first one is at least as old as the second. # NB: The function should return True if both values are same. def older(a, b): pass def test_older(): assert type(older((1, 1, 1900), (1, 1, 1900))) == type(True) assert older((1, 1, 1995), (2, 1, 1995)) assert not older((2, 1, 1995), (1, 1, 1995)) assert older((1, 1, 1995), (1, 1, 1995)) assert older((31, 12, 1995), (1, 1, 1996)) assert not older((31, 4, 1995), (1, 4, 1995)) assert not older((1, 4, 1995), (31, 3, 1995)) assert not older((1, 1, 1996), (1, 1, 1995)) assert not older((1, 2, 1995), (1, 1, 1995)) 
# Given a list, return a list with the given lists consecutive elements grouped into tuples. # The input list is guaranteed to have an even number of elements. # Hint: You may want to use xs[i] to access elements of the list. def pairs(xs): pass def test_pairs(): assert pairs([]) == [] assert pairs([100, 200]) == [(100, 200)] assert pairs([1, 2, 3, 4]) == [(1, 2), (3, 4)] assert pairs([1, 2, 3, 4, 5, 6, 7, 8]) == [(1, 2), (3, 4), (5, 6), (7, 8)]

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

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions

Question

=+How might you explain this phenomenon?

Answered: 1 week ago