Question

Kids in Iceland can play outside if the temperature is between -10 and 25 degrees. If...

Kids in Iceland can play outside if the temperature is between -10 and 25 degrees. If it's summer then the bottom limit is 0 degrees. Write the Python program KidsPlay.py that gets from input the integer temperature and boolean value summer, and prints True if the statement in the input is true, and False if the input statement is false.

Enter the temperature and Boolean value: -5 True
Is the statement correct?: False
Enter the temperature and Boolean value: -5 False
Is the statement correct?: True

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Python Code:

stmt = input("Enter the temperature and Boolean value: ")

temp = int(stmt.split(" ")[0])

summer = stmt.split(" ")[1]

print("Is the statement correct?: ",end='')

if summer == "True":

                if temp >= 0 and temp <= 25:

                                print(True)

                else:

                                print(False)

else:

                if temp >= -10 and temp <= 25:

                                print(True)

                else:

                                print(False)

OUTPUT:

Enter the temperature and Boolean value: -5 True Is the statement correct?: False

Add a comment
Know the answer?
Add Answer to:
Kids in Iceland can play outside if the temperature is between -10 and 25 degrees. If...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • please help by python compiler Suppose the temperature of your coffee is 125 degrees Fahrenheit. You...

    please help by python compiler Suppose the temperature of your coffee is 125 degrees Fahrenheit. You want to drink it at 110 degrees. A chip of ice turns out to lower the temperature one degree each time. You test the temperature each time. and also print out the temperature before reducing the temperature. Write a code in python for this. The number of views of a Youtube Channel was increasing in the order of 5.8,13,21,34 for the first 5 days....

  • Using Python.Thanks Q3 - Alfonso will only wear a jacket outside if it is below 60...

    Using Python.Thanks Q3 - Alfonso will only wear a jacket outside if it is below 60 degrees or it is raining. Write a function that takes in the current temperature and a boolean value telling if it is raining and it should return True if Alfonso will wear a jacket and False otherwise. First, try solving this problem using an if statement. def wears_jacket_with_if(temp, raining):     """     >>> wears_jacket(90, False)     False     >>> wears_jacket(40, False)     True     >>> wears_jacket(100, True)     True     """         ...

  • x= Suppose you are building a program for teaching kids' math. Write a java program the...

    x= Suppose you are building a program for teaching kids' math. Write a java program the does the following: 1. Ask the user if he/she wants to sign-up a. If yes continue to step 2 b. If no Display the message "Thank you, Have a nice Day 2. Ask the user to enter a username. 3. Ask the user to enter a password with at least 8 characters long 4. Write a method with the following header: public static Boolean...

  • in Python: Write a program that allows the user to enter a number between 1-5 and...

    in Python: Write a program that allows the user to enter a number between 1-5 and returns an animal fact based on what the user entered. The program should 1. Continue to run until the user enters “quit” to terminate the program, and 2. Validate the user’s input (the only acceptable input is 1, 2, 3, 4, 5 or “quit”). You can use the following animal facts: An octopus is a highly intelligent invertebrate and a master of disguise. Elephants...

  • Summer, 2018 9. What will be returned from the following method? public static int methodA(0 double...

    Summer, 2018 9. What will be returned from the following method? public static int methodA(0 double a 8.5+9.5 return a 10. Use Scanner and switch. between 1 and 5. Evaluate the number and display the corresponding vowel: Write a program that prompts the user to enter an integer Vowel Integer 2 Match each term with the correct statement below. a. relational operator b. NOT operator c. Boolean values dual-alternative e. switch statement i. AND operator true and false ouble equal...

  • 4- You estimate the temperature outside is 65 degrees Fahrenheit. After checking the local weather report,...

    4- You estimate the temperature outside is 65 degrees Fahrenheit. After checking the local weather report, you find that the temperature is actually 61 degrees Fahrenheit. What is the percent error of your temperature estimate? 1) -6.1%, 2)6.6%, 3)-6.5%, 4) 0.06%, 5)6.6% error, 6) 6.5%error, 7) 6.6%percent error, 8) 6.5 percent error. 5- You should report a scientifically measured result as: measured quantity = ______ ± ________. 1) average, mean value 2)average, standard deviation 3)variance, percent error 4) mean value,...

  • When breaking a problem down, you often encounter elements that you want to use repeatedly in...

    When breaking a problem down, you often encounter elements that you want to use repeatedly in your code. Sometimes it's appropriate to write a new function; at other times it's appropriate to write a loop. What do you think? What kinds of circumstances would lead you to writing a function versus using a loop? What is the error in the pseudocode below? Re-write the pseudocode in your answer document. Declare Boolean finished = False Declare Integer value, cube While NOT...

  • 1) Translate the following equation into a Python assignment statement 2) Write Python code that prints...

    1) Translate the following equation into a Python assignment statement 2) Write Python code that prints PLUS, MINUS, O ZERO, depending on the value stored in a variable named N. 3) What is printed by: 3 - 1 while 5: while 10 Print ) Page 1 of 9 4) Write a Python while loop that reads in integers until the user enters a negative number, then prints the sum of the numbers. 1-2 of 9 4) Write a Python while...

  • i need a python code For an exact conversion between "Fahrenheit temperature scale" and "Celsius temperature...

    i need a python code For an exact conversion between "Fahrenheit temperature scale" and "Celsius temperature scale", the following formulas can be applied. Here, F is the value in Fahrenheit and the value in Celsius: Temperature Conversions C = 5 9 (F - 32) F = (š xc) + 3 Write a Python program that uses the above formula to convert Celsius to Fahrenheit and vice versa. We ask user to input "Enter a degree: ", and then we get...

  • Can someone help me with this Python code Summary In this lab, you work with the...

    Can someone help me with this Python code Summary In this lab, you work with the same Python program you worked with in Labs 5-1 and 5-3. As in those earlier labs, the completed program should print the numbers 0 through 10, along with their values multiplied by 2 and by 10. However, in this lab you should accomplish this using a while loop with a break statement. Instructions Make sure that the file NewestMultiply.py is selected and open. Write...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT