hdncjdksksmsksk

Ace your homework & exams now with Quizwiz!

what is the output of this code? print(3 * '7')

777

how many items are in this list? [2,]

1

what does this expression evaluate to? 3 + 2 * 5

13

what is the output of this code? import math as m print(math.sqrt(25))

an error occurs

drag and drop from the options below to add 'z' to the end of the list and print the list's length list. _____ ('z') print(_____ _____)

append, len, (list)

which code can you use to print if a test score is a pass or fail?

if (score>=60): print("passed") else: print("failed")

which line of code is the correct code?

if x > 10: print('x is greater than 10')

fill in the blanks to print "Yes" if the list contains 'z': letters = ['a' , 'b' , 'z'] _____ "z" _____ letters: print("Yes")

if, in

which one of these codes will work?

import random num1 = random.randint(1,10) print("The number is " + str(num1))

what will this code generate when written on python? num1 = 6 num2 = 10 if num1<num2: print('number 1 is less than number 2') elif num1==num2: print('the numbers are equal') else: print('number 2 is greater than number 1')

number 1 is less than number 2

how would you write the "Hello, world!" program in python?

print("Hello, world!")

which line of code is NOT the correct use of strings?

print("She said, "Unbelievable" to him")

which python keyword is used to send back values from a function?

return

can a docstring contain multiple lines of text?

true

python functions can be external files

true

the default type of variable saved in an input is a string

true

my_word = "hello" what is the variable named in the line above?

my_word

what is the output of the following python code? first_name = "Jeff" #first_name = "Sara" print(first_name)

Jeff

what is the output of the following python code? first_name = "Jeff" First_name = "Sara" print(first_name)

Jeff

what character starts a comment in python?

#

what will the following program print? def mult_inv(num): return 1/num result=mult_inv(3) print(result)

.333333

what is the result of this code? letters = ["a", "b", "c"] letters.append("d") print(len(letters))

4

what does this code output? print(1 + 2 + 3)

6

what is the result of this code? def print_double(x): print(2 * x) print_double(3)

6

python may require special characters at the end of functions and conditional statements, such as:

: (colon)

which of these is not a relational operator?

=

which of these is a valid variable name in python?

A_VARIABLE_NAME

what IDE feature allows you to get code suggestions while you are typing?

IntelliSense

what is the output to this code? num1 = 7 if (num1 < 5): print("The number is smaller than 5") elif (num1 > 5): print("The number is larger than 5") elif (num1 == 5): print("The values are equal") else: print("Not a valid number")

The number is larger than 5

if i want to write a function, which code will i have in my program?

def myFunction(): print("This code")

following the DRY principle makes the code:

easier to maintain

libraries are useless in python

false


Related study sets

Iggy NCLEX Qs-Gallbladder-Chapter 59: Care of Patients with Problems of the Biliary System

View Set

Chapter 12: Leadership Power & Influence

View Set

Gibbs VALLE Environmental Chapter 6 Biomes

View Set

Psychology of Learning Troy University Test 5 - Rost

View Set