id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

peter@norvig.com > stevie_and_his_moto
prev  |  next  |  chance

This was CarTalk Puzzler #201016: RAY: Stevie had decided it was time to take his motorcycle to work. It had been in a garage all winter, and, finally, the weather had gotten nice. So, he gets it out of mothballs, siphons gas out of the lawn mower, fires up the tank, and off he goes. He's enjoying the beautiful sunshine and the warm air. He comes to an intersection that he goes through every day...but he's usually driving his car, and when you're on a motorcycle you're keenly aware of everything around you. He looks up at a building to his right, and he sees one of those big signs that display the time and temperature. He notices the time, and says, "Geez, I guess I'm really late for work! But, I'll stay late, not to worry!" Then, the temperature comes up in Fahrenheit, and a few seconds later it comes up in centigrade. Stevie says, "Hah! That's interesting. The digits are exactly reversed." For example, it might have read 31 degrees Fahrenheit, and when it showed the centigrade reading it said "13." He thinks, "I've never seen that before." The light turns green, and off he goes to work. Well, because he got to work so late, he decided to stay late. When he comes out of work, he realizes he should have checked the weather forecast, because it's drizzly, rainy, and cold. He's riding home, when he comes to the same intersection. He thinks, "What are the chances I'd ever see that again?" He knows it's a different temperature because it's not warm and sunny like it was when he went to work, and now it's cold, drizzly, and rainy. He sees the temperature in Fahrenheit, and the temperature in centigrade. TOM: Let me guess! They're the same digits reversed, again. RAY: What are the chances? Only in a puzzler could this happen! The question is, what was the temperature in the morning when he went to work, and what was the temperature when he went home? For CodingBat, return your answer as a list of two numbers, in Fahrenheit. I apologize that the single test case gives away the solution. Of course you could define stevie_and_his_moto to just do "return [82, 61]", but I know you will actually have it compute the answer.


stevie_and_his_moto() → [82, 61]

...Save, Compile, Run (ctrl-enter)

def stevie_and_his_moto():

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 322 Post-solution available

Copyright Nick Parlante 2017 - privacy