subject

Critical Thinking QuestionsIn this unit, you used this code to ensure that the user would enter a number and not letters:while True: try: num = int(input("Enter your age: ")) break except ValueError: print("That's not a number!")How could you modify this code to be sure that the user enters a positive number?You are writing a program in JavaScript that asks users to input their grade level. You want to check for errors and give the users an error message if they 1) enter a blank, 2) enter letters instead of numbers, or 3) enter a number greater than 12. What would the pseudocode look like for a function that would check these things?In this lesson, you learned that the five most common Python errors are incorrect indentation, count errors in loops, confusion of single and double equal signs, punctuation errors, and spelling errors. Based on your own programming experience, what are some other common errors? What are some things that you can do to avoid or easily catch those errors?You are creating a function that will test whether a number is greater than 10 using these lines of code:if a < 10: print(a "is greater than 10")Can you identify one syntax error and one logic error in these lines? Why do you think a programmer might have made the logic error?You are creating a program in which the user will input his or her age. The program will calculate the year that the user was born and will then tell the user which decade he or she was born in. Here is part of the code:if year > 1989 and year < 2000 print("You were born in the 1980s")Can you identify one syntax error and one logic error in these lines? How do you think you could avoid making logic errors like the one in this code?

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 11:00, Lacey9319
The editing of digital photos us about the same level of difficulty as editing an analog photo
Answers: 2
image
Computers and Technology, 22.06.2019 13:00, Cookie320
Write a program which asks you to enter a name in the form of first middle initial last. so you might enter for example samuel p. clemens. use getline to read in the string because it contains spaces. also, apparently the shift key on your keyboard doesn’t work, because you enter it all lower case. pass the string to a function which uses .find to locate the letters which need to be upper case and use toupper to convert those characters to uppercase. the revised string should then be returned to main in the form last, first mi where it will be displayed.
Answers: 1
image
Computers and Technology, 23.06.2019 06:20, kiarakagni
What is a point-in-time measurement of system performance?
Answers: 3
image
Computers and Technology, 23.06.2019 07:30, devnnn44
What is the original authority for copyright laws
Answers: 1
You know the right answer?
Critical Thinking QuestionsIn this unit, you used this code to ensure that the user would enter a nu...

Questions in other subjects:

Konu
Mathematics, 25.10.2021 17:50
Konu
Mathematics, 25.10.2021 17:50
Konu
Computers and Technology, 25.10.2021 17:50
Konu
History, 25.10.2021 17:50