Python Programming Assignment | Online Homework Help

Instruction for this assignment will be in a word document. example for this assignment will be provided as well in a word document

QUESTION 3

Don't use plagiarized sources. Get Your Custom Essay on
Python Programming Assignment | Online Homework Help
Get an essay WRITTEN FOR YOU, Plagiarism free, and by an EXPERT!
Order Essay

#Program for various statements in python

lst = [1,3,5,7,9,”True”,76,10,11,14,”hello”,76,12,16,3,4,3,76,3]

#Print the original list
print(“Printing the original list…”)
print(str(lst))
print(“\n”)

#Append “apple” and 76 to the list
print(“Append ‘apple’ and 76 to the list…”)
print(str(lst))
lst.append(“apple”)
lst.append(76)
print(str(lst))
print(“\n”)

#Insert “cat” at position 3 in the list
print(“Insert ‘cat’ at position 3 in the list…”)
print(str(lst))
lst.insert(2, “cat”)
print(str(lst))
print(“\n”)

#Insert value 99 at the start of the list
print(“Insert value 99 at the start of the list…”)
print(str(lst))
lst.insert(0, 99)
print(str(lst))
print(“\n”)

#find the index of “hello” from the list
print(“find the index of ‘hello’ from the list…”)
helloIndex = lst.index(“hello”)
print(str(helloIndex))
print(“\n”)

#count the number of 76 in the list
print(“count the number of 76 in the list…”)
num76 = lst.count(76)
print(str(num76))
print(“\n”)

#remove the first occurence of 76 from the list
print(“remove the first occurence of 76 from the list…”)
print(str(lst))
lst.remove(76)
print(str(lst))
print(“\n”)

#Remove true from the list using pop and index
print(“Remove true from the list using pop and index…”)
print(str(lst))
trueIndex = lst.index(“True”)
popValue = lst.pop(trueIndex)
#print(str(popValue))
print(str(lst))

 

Figure 1: Question 3 output screenshot

 

QUESTION 4

#Program to create random integers and sum and get average

from __future__ import division

import random
#define the function that gets the average of a list
def listAverage(lst):
avg = 0.0
avg = sum(lst)/len(lst)
return avg

#Initialize the list
lst = []

#generate the random list of integers between 0 and 1000
for i in range(100):
num = random.randint(0, 1000)
lst.append(num)

listAverage = listAverage(lst)

#print the outcome
print(“Average of the list is: ” + str(listAverage))

 

 

Figure 2: Question 4 screenshot

 

 

 

 

 

QUESTION 10

#Program to count how many words in a list have length 5

 

#define function to get number of words of specified length in supplied list

def wordLengthCount(lst, length):
numberWord = 0
for item in lst:
if(len(item) == length):
numberWord += 1
return numberWord

#declare and initialize list of words
wordlist = [‘number’,’testing’,’words’,’five’,’seven’,’six’,’nine’,’ten’,’eight’,’sixteen’,’seventeen’,’twenty’,’twelf’]
#print the list
print(str(wordlist))

#get number of words of length 5 using the function defined above
numberWord5 = wordLengthCount(wordlist, 5)

#print the result
print(“Total number of words with length 5 is:\n” + str(numberWord5))

 

 

Figure 3: Question 10 output screenshot

 

 

 

 

QUESTION 11

#Program to sum all the elements of a list up to but not including the first even number

#define function to sum all elements up to but not including first even number of supplied list

def sum2FirstEven(lst):
sumElements = 0
numElements = 0

for item in lst:
if((item%2) == 0):
break
else:
sumElements += item
numElements += 1

#return the result as a tuple
return (numElements, sumElements)

#initialize the list to test with
testlist = [1,3,5,7,9,10,11,14,12,16]
#print the test list
print(str(testlist))

#obtain the number and sum of elements up to first even number using function defined above
(elemNum, elemSum) = sum2FirstEven(testlist)

#print the outcome
print(“Total sum of ” + str(elemNum) + ” elements is ” + str(elemSum))

 

 

Figure 4: Question 11 output screenshot

 

 

 

Quick Homework Essays
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.