- Write a program that outputs the string representation of numbers from 1 to 100.
But for multiples of 7 it should output “Credit” instead of the number and for the multiples of 5 output “Karma”. For numbers which are multiples of both 7 and 5 output “Creditkarma”.
- GIVEN A LIST OF FLIGHTS (IN ANY ORDER), CONSTRUCT THE TRIP
THAT THIS LIST REPRESENTS. FOR EXAMPLE, IF WE HAVE A FLIGHT
FROM SAN FRANCISCO TO DALLAS AND A FLIGHT FROM LOS ANGELES
TO SAN FRANCISCO, THE TRIP IS “LAX TO SFO TO DFW”.
ASSUMPTIONS:
- EACH CITY WILL BE VISITED ONLY ONCE.
- THE LIST WILL ONLY REPRESENT ONE SINGLE TRIP.
FLIGHTS = [(‘SFO’, ‘DFW’), (‘LAX’, ‘SFO’), (‘DFW’, ‘CLT’)]
TRIP: [‘LAX’, ‘SFO’, ‘DFW’, ‘CLT’]
IF THE ABOVE WORKS, TRY YOUR PROGRAM WITH THE FOLLOWING INPUT:
FLIGHTS = [(‘DFW’,‘CLT’), (‘SFO’,‘DFW’), (‘WAS’,‘NYK’), (‘LAX’,‘SFO’), (‘CLT’,‘WAS’)]
TRIP: [‘LAX’, ‘SFO’, ‘DFW’, ‘CLT’, ‘WAS’, ‘NYK’]