Your Perfect Assignment is Just a Click Away

Starting at $8 per Page

100% Original, Plagiarism Free, Customized to Your instructions!

glass
pen
clip
papers
heaphones

Computer Science Help

Computer Science Help

Review the videos and read Chapter 11-13 in the online book of “Python 2: For Beginners Only.”  

 

Use Python to run the following .py Files with the original values and statements. Next, change some of the values to the following. Please keep in mind that statements may change accordingly once you modify the programs. The modified programs must execute correctly.

 

Code is adapted from MITOpenCourseWare, “A gentle introduction to programming using Python” (under the Open Education Consortium Global Network for Open Education and authorized by the creative commons license). 

 

For Example 1, change “Hi Class!” to “Good Morning All”

 

For Example 2, change [3, 4, 5, 6] to [1.50, 7, 2.75, 9]

 

For Example 3, change (5, 6, 7, 8) to (100, 101, 102, 103)

 

 

 

1 – String Examples.py File

 

 

 

# Lecture 4

# string_examples.py

 

 

# Strings

 

 

# Define a string

new_string = “Hi Class!”

# Remember we can iterate through it

for letter in new_string:

    print letter

 

 

# We can concatenate two strings together

s1 = “Hi”

s2 = “Class”

print s1 + s2

 

 

# but remember, gluing together with a comma adds an extra space

print s1, s2

 

 

# and with a comma you can glue together different data types

print s1, 6.189, s2

 

 

# We can index the string

print “new_string[0] is”, new_string[0]

# And slice it

print “new_string[0:3] is”, new_string[0:3]

 

 

# We can get the length of our string using the len function

print “len(new_string) is:”, len(new_string)

 

 

# And use various string methods on it

print “new_string.upper()”, new_string.upper()

print “new_string.lower()”, new_string.lower()

 

 

2 – List Examples.py File

 

 

 

# Lecture 4

# list_examples.py

 

# Lists are defined by brackets

 

new_list = [3, 4, 5, 6]

print “new_list is:”, new_list

 

# Just like strings, we can index & slice them

print “new_list[2] is:”, new_list[2]

print “new_list[0:2] is:”, new_list[0:2]

 

# And iterate through them:

for item in new_list:

    print item

 

# Lists, however, are mutable! So, if we want we can change the

# value of one element

 

new_list[2] = 100

print “new_list is:”, new_list

 

# Or, add on a new element with append:

new_list.append(87)

print “new_list is:”, new_list

 

# Or insert

new_list.insert(0, 200) # insert at position 0 the element 200

print “new_list is:”, new_list

 

# Or even delete an element using remove

new_list.remove(100) # Write in the item that you want to remove from the list

print “new_list is:”, new_list

 

# Lists are possibly the most useful data structure in Python!

# We’ll see more about them in lab; check out the documentation on

# list methods for more cool things to do

 

 

3 – Tuple Examples.py File

 

 

# Lecture 4

# tuple_examples.py

 

 

# Tuples are immutable and defined by parentheses

 

 

new_tuple = (5, 6, 7, 8)

print “new_tuple is:”, new_tuple

 

 

# We can index them, just like strings

print “new_tuple[2] is:”, new_tuple[2]

 

 

# And iterate through them:

for item in new_tuple:

    print item

 

 

# Even show how long they are

print “Tuple length is:”, len(new_tuple)

 

 

# and iterate through indicies

 

 

for index in range(len(new_tuple)):

    print “Index is:”, index

    print “Value at that index is:”, new_tuple[index]

 

 

# But because they are immutable, we cannot redefine

#  a single element (remember this does work with lists, though)

#new_tuple[1] = 77 # Returns an error

 

 

 

 

# We can also do something called _tuple unpacking_

 

 

(a, b, c, d) = new_tuple

print “a is:”, a

print “b is:”, b

print “c is:”, c

print “d is:”, d

 

 

# Make sure that you always have the same number of

# variables when you unpack a tuple!

 

 

# Tuples are immutable. To change a tuple, we would need

# to first unpack it, change the values, then repack it:

 

 

# Redefine b

b = 77

 

 

# Repack the tuple

new_tuple = (a, b, c, d)

print “new_tuple is now:”, new_tuple

 

 

Once you have executed these programs (1 – String Example; 2 – List Examples; and 3- Tuple  Examples), modify the .py files according to the instructions given to revise the code by program examples. You need to run the IDLE to execute the program changes and review the program results.

 

You can use the Snipping tools or screen print (ctrl + Print Screen) to show the Pythons editor’s (IDLE) code and results and demonstrate that your program executed correctly.

 

Create a submission file named as “ITM205-Case 4-Exercises-YourFirstNameLastName “containing executed programs (.py files) for 1 – String Example; 2 – List Examples; and 3- Tuple  Examples.

 

Write a summary document in Microsoft Word format named “ITM205-Case 4-Summary-YourFirstNameLastName” to show what you have accomplished.


"Place your order now for a similar assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Order Solution Now

Our Service Charter


1. Professional & Expert Writers: Eminence Papers only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Eminence Papers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Eminence Papers is known for timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Eminence Papers, we have put in place a team of experts who answer to all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.