Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

someone Please help me with these!! its due in 4 hours.. Thank you! this is the code i wrote and rhe error its giving me.

image text in transcribed

someone Please help me with these!! its due in 4 hours..

Thank you!

image text in transcribedthis is the code i wrote and rhe error its giving me. i got it to sort out the array but there's an error with the print statement.
image text in transcribed
3) Write a python program that will make user input elements in a list using the input built_in function and returns the second largest element in the list entered. (15 pts) 4) Create a text file with some sentences. Write a python program that will read a random line from the file. (5 pts) 5) Create a text file with some text. Write a program that will open the file and count the number of capital characters in the file. (15 pts) jupyter Untitled 15 File Edit View Insert Cell Kernel Widgets Help Trusted + 9 B N C Code In [109]: list = [] num = int(input("numer of elements: ")) for i in range(0, num): elements = int(input) list.append(elements) def sort(): for i in range(0, num): if list[num-1] > list[num] : list[num-1] = temp temp = list[num] list[num] = list[num-1] def secondMax(list): print(list) max = list[0] secondmax = 0 for i in range(len(list)): if(list[i]>max): secondmax = max max = list[i] print('secondMax: '+ str(secondMax)) def secondMax2(1st): 1st.sort lst print("Second max number is: "+ str(Ist[-2])) list.sort() secondMax(list) OO DO 6 Pyth G pyrai Spri ini (2) V w Pyth r ead C 3) e localhost:8888otebooks/Untitled 15.ipynb?kernel_name=python3 ter Untitled 15 View Insert cell Kernel Widgets Help BANIC Code Trusted Pytha numer of elements: 3 (1, 5, 6] TypeError Traceback (most recent call last) in 32 33 list.sort() ---> 34 secondMax(list) 36 in secondMax(list) 23 secondmax = max max = list[i] print('secondMax: '+ str(secondMax)) 25 26 TypeError: 'str' object is not callable [128]: import random de admin

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Power Of Numbers In Health Care A Students Journey In Data Analysis

Authors: Kaiden

1st Edition

8119747887, 978-8119747887

More Books

Students also viewed these Databases questions