1. Given the following code, identify the errors and fix it to make this program run. Requirements: A. List the statements/expressions/rules that you think causes an error to the program B. Revise the code so that the errors will be fixed. Code snippets:

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Pls specify 

your ability:
1. Given the following code, identify the errors
and fix it to make this program run.
Requirements:
A. List the statements/expressions/rules that
you think causes an error to the program
B. Revise the code so that the errors will be fixed.
Code snippets:
а.
num - int(input('Enter a number: '))
if num > e:
print('Positive')
elif num < e:
print('Negative')
else:
print('Zero')
b.
print('I'm the greatest of all!')
С.
The volume of a cylinder can be expressed using the formula arh, this
program will ask for the value of radius and height of a Cylinder from the
user and will compute its volume.
rad - input('Enter radius: ')
height - input('Enter height: ')
volume - math.pirr height
print('Volume is: X.2f', Xvolume)
d.
Wheras the Total Surface Area can be obtain using this formula =
2arh + 2ar²
rad - input('Enter radius: )
height - input('Enter height:
1stequation - 2* math.pi rh
equation2 - 2 math.pi r
total surface area - 1stequation + equation2
print("Radius - (1}\nHeight - (2}\t Total surface area
(3)". format(rad, height, total1 surface area))
It should have this output when successfully
executed:
Enter radius:5
Enter height: 6
Radius - 5
Height = 6
Total surface area 345.5751918948772
2. In this code snippet,
phrase1 = "Talk is cheap."
phrase2 = "Show me the code!"
give the python expression that would construct
the following results:
a)
'alk'
b)
'heap'
с)
'me'
d)
"Talk the code.'
e)
"Talk is cheap! Talk is cheap!'
f)
'Me'
g)
['TALK', 'IS', 'CHEAP.']
3. Based on this list declaration.
myList = [1.5, 2.3, 7.9, 8,20]
Give the results of the following Python
expression:
max (myList)
b)
a)
myList.append(10)
newList = myList.copy()
myList.insert(4, 'Hello')
e) len(newlist)
с)
d)
f) myList.remove('Hello')
g) myList.sum()
Transcribed Image Text:your ability: 1. Given the following code, identify the errors and fix it to make this program run. Requirements: A. List the statements/expressions/rules that you think causes an error to the program B. Revise the code so that the errors will be fixed. Code snippets: а. num - int(input('Enter a number: ')) if num > e: print('Positive') elif num < e: print('Negative') else: print('Zero') b. print('I'm the greatest of all!') С. The volume of a cylinder can be expressed using the formula arh, this program will ask for the value of radius and height of a Cylinder from the user and will compute its volume. rad - input('Enter radius: ') height - input('Enter height: ') volume - math.pirr height print('Volume is: X.2f', Xvolume) d. Wheras the Total Surface Area can be obtain using this formula = 2arh + 2ar² rad - input('Enter radius: ) height - input('Enter height: 1stequation - 2* math.pi rh equation2 - 2 math.pi r total surface area - 1stequation + equation2 print("Radius - (1}\nHeight - (2}\t Total surface area (3)". format(rad, height, total1 surface area)) It should have this output when successfully executed: Enter radius:5 Enter height: 6 Radius - 5 Height = 6 Total surface area 345.5751918948772 2. In this code snippet, phrase1 = "Talk is cheap." phrase2 = "Show me the code!" give the python expression that would construct the following results: a) 'alk' b) 'heap' с) 'me' d) "Talk the code.' e) "Talk is cheap! Talk is cheap!' f) 'Me' g) ['TALK', 'IS', 'CHEAP.'] 3. Based on this list declaration. myList = [1.5, 2.3, 7.9, 8,20] Give the results of the following Python expression: max (myList) b) a) myList.append(10) newList = myList.copy() myList.insert(4, 'Hello') e) len(newlist) с) d) f) myList.remove('Hello') g) myList.sum()
Expert Solution
steps

Step by step

Solved in 4 steps with 6 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY