ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 90 Weeks Ago, 6 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 08 May 2017 My Price 8.00

Write a Python program that will open a file named “thisFile.txt”

1. Write a Python program that will open a file named “thisFile.txt” and write every line of“thisFile.txt” into the file “thatFile.txt”. 

2. Compare and contrast strings, lists, and tuples. For example, consider what they can hold and what operations can be done on the data structures. 

3. Consider the following code: list_var = []

for i in range (0, 6, 2) :

for k in range (4) :

list_var.append (i + k)

print(i) # Line 1

print(k) # Line 2

print(list_var) # Line 3

(a) What is printed by Line 1?

(b) What is printed by Line 2?

(c) What is printed by Line 3?

4. Tuples resemble lists in many ways. However, as an immutable type, the ways in which they can be interacted with are limited. Take the following statements. What will happen if you try to add to the tuple in the manner shown? How can you rewrite the code to achieve the intended result?

tuple_var = ()

for i in range (10) :

tuple_var += i5.

What are the characteristics of sets?

6. Given dict_var = {‘a’ : 3, ‘x’ : 7, ‘r’ : 5}.

(a) Write Python code that returns the value at key ‘x’.

(b) Write Python code that returns the key given value ‘7’.

7. If dict_var = {‘a’ : 15, ‘c’ : 35, ‘b’ : 20}, write Python code

(a) to print all the keys

(b) to print all the values

(c) to print all the keys and values pairs

(d) to print all the keys and values pairs in order of key

(e) to print all the keys and values pairs in order of value

8. If set_one = ‘bcd’, and set_two = ‘abcde’

(a) What is the value of set_one.issubset (set_two) ?

(b) What is the value of set_two.issubset (set_one) ?

9. Write a function power that takes in a base and an exp and recursively computes baseexp. You are not allowed to use the ** operator. 

10. Provide two small numbers for base and exp in function power, and draw the figure to trace there cursive function calls.

Answers

(11)
Status NEW Posted 08 May 2017 03:05 AM My Price 8.00

-----------

Not Rated(0)