hello, please help me to answers my python subjects, I'm new students.
I highly appreciate your effort. thanks in advanced.. Kindly answers all of this please, I'm begging...
1.) Knowing that a function named fun() resides in a module named mod, choose the proper way to import it:
a.) from mod import fun
b.) from fun import mod
c.) import fun
d.) import fun from mod
2.) Knowing that a function named fun() resides in a module named mod, and it has been imported using the following line:
import mod
choose the way it can be invoked in your code:
a.) mod.fun()
b.) fun()
c.) mod::fun()
d.) mod->fun()
3.) A function returning a list of all entities available in a module is called:
a.) listmodule()
b.) content()
c.) dir()
d.) entities()
4.) The pyc file contains:
a.) compiled Python code
b.) Python source code
c.) a Python compiler
d.) a Python interpreter
5.) When a module is imported, its contents:
a.) may be executed (explicitly)
b.) are ignored
c.) are executed once (implicitly)
d.) are executed as many times as they are
imported
6.) A predefined Python variable, storing the current module name,
is called:
a.) __mod__
b.) __modname__
c.) __module__
d.) __name__
7.) The following statement:
from a.b import c
causes the import of:
a.) entity c from module b from package a
b.) entity c from module a from package b
c.) entity b from module a from package c
d.) entity a from module b from package c
8.) Entering the try: block implies that:
a.) none of the instructions from this block will
be executed
b.) some of the instructions from this block may not
be executed
c.) all of the instructions from this block will be
executed
d.) the block will be omitted
9.) The unnamed except: block:
a.) cannot be used if any named block has been
used
b.) can be placed anywhere
c.) must be the last one
d.) must be the first one
10.) The top-most Python exception is named:
a.) TopException
b.) BaseException
c.) PythonException
d.) Exception
11.) The following statement:
assert var == 0
a.) has no effect
b.) will stop the program when var == 0
c.) is erroneous
d.) will stop the program when var != 0
12.) ASCII is:
a.) a predefined Python variable name
b.) a standard Python module name
c.) a character name
d.) short for American Standard Code for Information
Interchange
13.) UTF-8 is:
a.) a Python version name
b.) a synonym for "byte"
c.) a form of encoding Unicode code points
d.) the 9th version of the UTF standard
14.) UNICODE is a standard:
a.) like ASCII, but much more expansive
b.) used by coders from universities
c.) for coding floating-point numbers
d.) honored by the whole universe
15.) The following code
x = '\''
print(len(x))
prints:
a.) 3
b.) 1
c.) 2
d.) 0
16.) The following code:
print(ord('c') - ord('a'))
prints:
a.) 1
b.) 0
c.) 3
d.) 2
17.) The following code
print(chr(ord('z') - 2))
prints:
a.) z
b.) a
c.) x
d.) y
18.) The following code
print(3 * 'abc' + 'xyz')
prints:
a.) abcxyzxyzxyz
b.) xyzxyzxyzxyz
c.) abcabcxyzxyz
d.) abcabcabcxyz
19.) The following code
print('Mike' > "Mikey")
prints:
a.) 1
b.) True
c.) 0
d.) False
20.) The following code:
print(float("1,3"))
a.) raises a ValueError exception
b.) prints 1.3
c.) prints 1,3
d.) prints 13
1.) Knowing that a function named fun() resides in a module named mod, choose the proper way to import it:
a.) from mod import fun
=====================================================================================
2.) Knowing that a function named fun() resides in a module named mod, and it has been imported using the following line:
import mod
choose the way it can be invoked in your code:
a.) mod.fun()
=====================================================================================
3.) A function returning a list of all entities available in a
module is called:
c.) dir()
a.) compiled Python code
=====================================================================================
5.) When a module is imported, its contents:
a.) may be executed
(explicitly)
=====================================================================================
6.) A predefined Python variable, storing the current module name,
is called:
d.) __name__
=====================================================================================
7.) The following statement:
from a.b import c
causes the import of:
a.) entity c from module b from package
a
=====================================================================================
8.) Entering the try: block implies that:
c.) all of the instructions from this block
will be executed
=====================================================================================
9.) The unnamed except: block:
c.) must be the last one
=====================================================================================
10.) The top-most Python exception is named:
d.) Exception
=====================================================================================
11.) The following statement:
assert var == 0
d.) will stop the program when var !=
0
=====================================================================================
12.) ASCII is:
d.) short for American Standard Code for Information
Interchange
=====================================================================================
13.) UTF-8 is:
c.) a form of encoding Unicode code
points
=====================================================================================
14.) UNICODE is a standard:
a.) like ASCII, but much more
expansive
=====================================================================================
15.) The following code
x = '\''
print(len(x))
prints:
b.) 1
=====================================================================================
16.) The following code:
print(ord('c') - ord('a'))
prints:
d.) 2
=====================================================================================
17.) The following code
print(chr(ord('z') - 2))
prints:
c.) x
=====================================================================================
18.) The following code
print(3 * 'abc' + 'xyz')
prints:
d.) abcabcabcxyz
=====================================================================================
19.) The following code
print('Mike' > "Mikey")
d.) False
=====================================================================================
20.) The following code:
print(float("1,3"))
a.) raises a ValueError
exception
=====================================================================================
hello, please help me to answers my python subjects, I'm new students. I highly appreciate your...
Chapter 08 Python Assignment: Question 1-5 Please I need help in my python course. Question 1 The finally clause of a try statement a. can be used to recover from an exception b. is required c. can be used to display more information about an exception d. is executed whether or not an exception has been thrown 10 points Question 2 Which of the following is the correct way to code a try statement that catches any type of exception...
I need help with my python class. thanks! Question 12 Code Example 4-4 main program: import arithmetic as a def multiply(num1, num2): product = num1 * num2 result = a.add(product, product) return result def main(): num1 = 4 num2 = 3 answer = multiply(num1, num2) print("The answer is", answer) if __name__ == "__main__": main() arithmetic module: def add(x, y): z = x + y return z Refer to Code...
Greeting! Kindly help me to solve my finals in PYTHON, I don't have a knowledge in PYTHON, new student. Please, please, I'm begging, Kindly answers all the questions. I'm hoping to grant my request. Thanks in advanced. 1.) What is the output of the following snippet? l1 = [1,2] for v in range(2): l1.insert(-1,l1[v]) print(l1) a.) [1, 2, 2, 2] b.) [1, 1, 1, 2] c.) [1, 2, 1, 2] d.) [1,...
*****THIS IS FOR MY PYTHON CLASS. PLEASE HELP***** { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "#### CS 497 Lab 1\n", "\n", "\n", "### Instructions\n", "0. Rename this file username_lab1. **Not literally, yourName_lab1 (technically correct, the best kind of correct!) but use your BU ID to fill in yourName.** If I was submitting this lab, it would be called dbrennan_lab1.\n", "1. Read all instructions carefully, ask questions if anything is confusing. \n", "2. Fill in the code/text blocks...
10q
I need help this is a python language
For the following question, refer to the Python module on the right, as well as the name of the file that contains each module. 1) What is the output of the following code?. import animals alist = [animals.cat('Garfield'), animals.Dog('odie'), animals. Fox ('Nicholas P. wilde'), animals. Animal ('Judy Hopps')] File animals.py class Animal: def _init__(self, name): self.name = name def getName(self): return self.name for a in alist: print( a.getName() + ', '...
Hello I need help with python programming here is my code # Trivia Challenge # Trivia game that reads a plain text file import sys def open_file(file_name, mode): """Open a file.""" try: the_file = open(file_name, mode) except IOError as e: print("Unable to open the file", file_name, "Ending program.\n", e) input("\n\nPress the enter key to exit.") sys.exit() else: return the_file def next_line(the_file): """Return next line from the trivia file, formatted.""" line = the_file.readline() line = line.replace("/", "\n") return line def next_block(the_file):...
Del Python is (choose all that apply) ext) call takes three arguments, senders e-mail receiver's e-mail and the e-mail text. A) Used in Scientific Applications D) Compiled Language 7, help) function call will open a different shell in Python shell We can run Python applications using Python Shell, IDLE and Command Line. A) True Dy False AT Thue B) False 8. Suppose that you have a Python file myApplication.py. You can run it by (choose all that apply) -3. To...
PYTHON CODING HELP: BELOW ARE THE STEPS I NEED HELP WITH PLEASE. :) First create a text file named "items.txt" that has the following data in this order: Potatoes Tomatoes Carrots ... and have it be in the same directory as the Python program you are coding for this assignment. IMPORTANT: Your program should work with any size file. It should work with 100 items listed or with no items in the file! Write a Python program that ... 1....
I need help in Python. This is a two step problem So I have the code down, but I am missing some requirements that I am stuck on. Also, I need help verifying the problem is correct.:) 7. Random Number File Writer Write a program that writes a series of random numbers to a file. Each random number should be in the range of 1 through 500. The application should let the user specify how many random numbers the file...
help with cse problem
Lab Exercise #11 Assignment Overview You will work with a partner on this exercise during your lab session. Two people should work at one computer. Occasionally switch the person who is typing. Talk to each other about what you are doing and why so that both of you understand each step Part A: Class Date . Download the files for this laboratory exercise, then run the Python shell and enter the following commands: >>>import date >>help(...