Chapter 2 Fundamentals of Programming Lambert

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What does a programmer do during the analysis phase of software development?

Writes the algorithms for solving a problem. -A programmer will write an algorithm for solving the problem during the analysis phase of software development and analyses the efficiency of the algorithm while solving the problem.

What must you use to create a multi-line string?

A single pair of three consecutive double quotation marks -In python, a multi-line string starts and ends with three consecutive double quotation marks. For example, the following code in python (3), print(""" HelloWorld""") will produce output: Hello World

What must a programmer use to test a program

All possible sets of inputs. -The performance of the program should be good in any condition and for all sets of inputs, not only on a limited number of sets. For this reason, during testing, the program is stress tested with many input sets.

What is used to begin an end-of-line comment?

# symbol -In python, end of line ( or single line) comments are started using # These lines are not interpreted by the interpreter. For example: print("1") #print("2") print("3") will output: 1 3

What is the purpose of the dir function and the help function?

The purpose of the dir() function is that it returns a list of symbols and names for any given object. The purpose of the help() function is to display modules, functions, classes and keyword documentation.

Write an import statement that imports just the functions sqrt and log from the math module.

from math import sqrt, from math import log

Write a program that takes the radius of a sphere (a floating-point number) as input and then outputs the sphere's diameter, circumference, surface area, and volume. (Ch2)

r = input("Please enter radius here:") d = int(r)*int('2') pi = 3.14159265359 r2 = int(r)**int('2') r3 = int(r)**int('3') sa = 4*pi*r2 v =4/3*pi*r2 print ("Diameter is : ", d) print ("Circumference is : ", d*pi) print ("Surface Area is : ",sa) print ("Volume is : ",v)


Set pelajaran terkait

Georgia DDS Learners Permit Test

View Set

Art of Comics Unit 3 Study Guide

View Set

RE Fundamentals CHAPTER ONE TERMS: Land, Real Estate and Real Property: Understanding the Difference

View Set

Howard University jewels 2016-17 information

View Set

Chapter 10: the New Frontier and the Great Society

View Set

Module 22: Biology, Cognition, and Learning

View Set