Python Quiz

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Which of these collections defines a LIST?

["apple", "banana", "cherry"]

What is the correct syntax to output the type of a variable or object in Python?

print(type(x))

Python can be used to write Java Scripts when there is no Java compliler available.

False

How do you create a variable with the floating number 2.8?

x = 2.8 x = 2.8 (float) ^ 0.2 / 1 point

Which statement is used to stop a loop?

break

What is the correct way to create a function in Python?

def myFunction():

How do you start writing a for loop in Python?

for x in y:

What is a correct syntax to output "Hello World" in Python?

print("Hello World")

Which method can be used to replace parts of a string?

replace()

What is a correct syntax to return the first character in a string?

x = "Hello"[0]"

How do you create a variable with the numeric value 5?

x = 5 x = int(5)

Which method can be used to remove any whitespace from both the beginning and the end of a string?

strip()

Which of these collections defines a DICTIONARY?

{"name": "apple", "color": "green"}

Which of these collections defines a SET?

{"apple", "banana", "cherry"}

Which collection is ordered, changeable, and allows duplicate members?

LIST

In Python, 'Hello', is the same as "Hello"

True

How do you insert COMMENTS in Python code?

#This is a comment

Which of these collections defines a TUPLE?

("apple", "banana", "cherry")

Which operator can be used to compare two values?

==

Which collection does NOT allow duplicate members?

SET


संबंधित स्टडी सेट्स

AP Psychology Final Exam Review 2022 PART TWO

View Set

Pharmacology Final- EAQ Questions

View Set

Klasszmagyar 2. beugró versek-Líra

View Set

STP 21-1-SMCT (April 2014) Request Medical Evacuation

View Set

ECON 1311 - EXAM 2 (assignment 7)

View Set

Concord Hymn Complete Study Guide

View Set

The t Test for Dependent Means (not single sample - two sample)

View Set