Question
use python IDEL
Please highlight the answer
Problem 1 Errors and Exceptions. There are two main types of errors: syntax errors and runtime errors. Syntax errors are dete
Question 5 0.5 pts # continue the code snippet above >>> a = A >>> try: z = x+y+a except NameError: print(Some variables a
Question 6 0.5 pts # continue the code snippet above >>>try: z = x + y + a except NameError: print(Some variables are not de
Question 7 0.5 pts >>> num = int(input (Enter an integer: )) Enter an integer: enter a record the error(only the last lin
Write a code snippet Write a code snippet of a function get_data () that asks the user to enter a float number and catches a
Question 10 0.5 pts #continue the code snippet above >>>get_data() enter 10 record the answer Question 11 0.5 pts # continue
Question 12 3 pts Write a code snippet Modify your function get_data() that allows the user to enter a value multiple times u
Question 13 1 pts Based on your code above: >>>get_data() enter abc output 1 = enter $2.0 output 2 = enter 5.95 output 3
0 0
Add a comment Improve this question Transcribed image text
Answer #1

question 5 ans:

Error:NameError

output:Some variables are not defined.

1 2 3 4 5 a=A try: Z=x+y+a except NameError: print(Some variables are not defined. ) Terminal File Edit View Search Termi

6 ans:

Answer: Some variables are not defined.

Error:NameError

1 2 3 4 5 try: Z=x+y+a except NameError: print(Some variables are not defined.) except TypeError: print(Some values are of

7 ans:

answer: ValueError

1 num=int(input (Enter an integer:)) Terminal File Edit View Search Terminal Help user@user-Latitude - 3490:-/Desktop$ pyth

def get_data():

1 2 3 4 def get_data(): try: n=float(input(enter )) print(You entered ,n) except ValueError: print(It is not a float num

10 ans:

You entered 10.0

1 2 3 4 5 6 7 def get_data(): try: n=float(input (enter )) print(You entered ,n) except ValueError: print(It is not a fl

11 ans:

It is not a float number!
2 3 4 def get_data(): try: n=float(input (enter )) print(You entered ,n) except ValueError: print(It is not a float numb

1 2 3 4 5 6 7 8 def get_data(): while(True): try: n=float(input(enter )) print(You entered ,n) break except ValueError: p

13 ans:

output1=It is not a float number!

output2=It is not a float number!

output3=You entered 5.95

#if you have any doubt or more information needed comment below..i will respond as possible as soon..thanks...

Add a comment
Know the answer?
Add Answer to:
use python IDEL Please highlight the answer Problem 1 Errors and Exceptions. There are two main...
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
  • use python IDEL Please highlight the answer 1 ווCIוסטIT Errors and Exceptions. There are two main...

    use python IDEL Please highlight the answer 1 ווCIוסטIT Errors and Exceptions. There are two main types of errors: syntax errors and runtime errors. Syntax errors are detected by the Python interpreter before the program execution during the parsing stage (parsing is a process, during which the Python interpreter analyzes the grammatical structure of the program). Runtime errors are errors in a program that are not detected by the Python interpreter during its parsing stage. They are further divided into...

  • use python IDEL Please highlight the answer Problem 2 Files. Since almost all data can be...

    use python IDEL Please highlight the answer Problem 2 Files. Since almost all data can be stored in files, knowing how to use files in programs is invaluable. Today you will practice with opening a file for reading, writing and editing using the Python interpreter. Do not type messages in red into Python shell Question 14 0.5 pts create a new file mytext.txt for >>>f1 = open("mytest.txt","w+") writing & reading >>>f1.write("hello\n") >>>for i in range(5): f1.write(str(i) + "\n") >>>f1.readlines() record...

  • 12p I need help this is Python EXCEPTIONS: It's easier to ask forgiveness than permission. Try...

    12p I need help this is Python EXCEPTIONS: It's easier to ask forgiveness than permission. Try the code and catch the errors. The other paradigm is 'Look before you leap' which means test conditions to avoid errors. This can cause race conditions. 1.Write the output of the code here: class MyError(Exception): pass def notZero(num): if num == 0: raise MyError def run(f): try: exec(f) except TypeError: print("Wrong type, Programmer error") except ValueError: print("We value only integers.") except Zero Division Error:...

  • (Python) Exercise-1: Raising Exceptions Try the following code one by one: raise NameError(‘Name not Found’) raise...

    (Python) Exercise-1: Raising Exceptions Try the following code one by one: raise NameError(‘Name not Found’) raise IndexError("Sorry, index not found!") raise KeyError("Sorry, my fault!") What it does? Exercise-2: Raising Exceptions Try the following code: try : raise NameError( 'Name not found' ) except NameError: print ( 'caught it' ) What it does? Exercise-3: Raising Exceptions using class Here is an example related to RuntimeError. Here, a class is created that is a sub-class from RuntimeError. This is useful when you...

  • use python IDEL Please highlight the answer Problem 3 Files. Read the following code and answer...

    use python IDEL Please highlight the answer Problem 3 Files. Read the following code and answer the next five questions about it. The contents of the files list 1.txt and list2.txt are the following (given side by side): list 1. txt content: list2.txt content 2 apples 2 apples 3 oranges 1 loaf of bread 2 eggs 2 eggs 1 cereal box # the program code starts here filename1 = "list 1.txt" filename2 - "list2.txt" filename3 - "listdiff.txt" with open (filename1,"r")...

  • Using python, write code for problem. Please also put screenshot of your code. The following program...

    Using python, write code for problem. Please also put screenshot of your code. The following program will perform properly if the user enters 0 in response to the request for input. However, the program will crash if the user responds with "eight". Rewrite the program using a try/except statement so that it will handle both types of responses. See Fig. 6.1. while True: n = int (input ("Enter a nonzero integer: ")) if n! = 0: reciprocal = 1/n print...

  • Using python 3.6 How do I incorporate 0 or negative input to raise an error and...

    Using python 3.6 How do I incorporate 0 or negative input to raise an error and let the user try again? like <=0 #loop to check valid input option. while True: try: choice = int(input('Enter choice: ')) if choice>len(header): print("Invalid choice!! Please try again and select value either:",end=" ") for i in range(1,len(header)+1): print(i,end=",") else: break choice = int(input('\nEnter choice: ')) except ValueError as ve:print('Invalid response, You need to select the number choice from the option menu') # Catch your...

  • PLEASE DO THIS IN PYTHON!! 1.) Goal: Become familiar with The Python Interpreter and IDLE. Use...

    PLEASE DO THIS IN PYTHON!! 1.) Goal: Become familiar with The Python Interpreter and IDLE. Use IDLE to type, compile, and run (execute) the following programs. Name and save each program using the class name. Save all programs in one folder, call it Lab1-Practices. Save all programs for future reference as they illustrate some programming features and syntax that you may use in other labs and assignments. ================================== Program CountDown.py =================================== # Program CountDown.py # Demonstrate how to print to...

  • use python IDEL Please highlight the answer Problem 2 Dictionary. Read the following code and answer...

    use python IDEL Please highlight the answer Problem 2 Dictionary. Read the following code and answer the next five questions about it. book1 = ("Alice":"arts", "Bob": "botany" "Clara": "chemistry", "Dasha": "digital media") book2 = {"Eve": "electronics", "Forest": "finances". "George": "geology", "Harry": "history". "Ivan": "Italian", "Joanna": "Japanese Arts") mybook=0 condition 1 = ? condition2 - ? condition3 = ? for key in book 1.keys(): mybook[key] =book 1.get(key) mybook.update(book 2) #first print statement print (mybook) if condition 1: mybook["Bob"] = "biochemistry" mybook["Eve"]...

  • use python IDEL Please highlight the answer Problem 1 Lists. Read the following code and answer...

    use python IDEL Please highlight the answer Problem 1 Lists. Read the following code and answer the next five questions about it. X = ? y=? z = ? zodiac = ["cow", "tiger", "rabbit", "dragon", "snake", "horse" "sheep", "monkey", "dog", "chicken", "pig", "rat"] first_group = zodiac[0:x] second_group = zodiac[x:y] third_group - zodiac[y:z] animals = [] for item in first_group: animals.append(item) for item in third_group: animals.append(item) for item in second group: animals.append(item) #first print statement print (animals) i = ? j...

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
ADVERTISEMENT