Save
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

matty py stack

QuestionAnswer
How do you import a package in Python? A) import package_name B) import (package_name) C) import: package_name D) import <package_name> A) import package_name
How do you denote a SINGLE-LINE comment in Python? A) // B) * C) # D) ` C) #
How do you write a function header in Python with no parameters? A) generator(): B) def generator: C) def generator(): D) generator: C) def generator():
How do you call a function in Python with no arguments? A) generator B) generator() C) call generator() D) generator(): B) generator()
How do you call a function from a package in Python (i.e datetime)? A) from datetime call now() B) datetime(now()) C) now() D) datetime.now() D) datetime.now()
How do you create a variable and Python and assign it to a string of "Hello World!"? A) var_name = Hello World B) str var_name = Hello World C) var_name = "Hello World" D) str var_name = "Hello World" C) var_name = "Hello World"
Let's say I had a "animal_str" variable of "DOG-CAT-PARROT" - how would I separate the string at each hyphen? A) animals = split(animal_str, "-") B) animals = animal_str(split("-")) C) animals = animal_str.split("-") D) animals =split.animal_str("-") C) animals = animal_str.split("-")
If I had a "my_list" var of list [1, 2, 3, 4, 5] (5 indices), how would I access the value of 3 in the list? A) my_list[2] B) my_list(2) C) my_list[3] D) my_list(3) A) my_list[2]
How do you convert an integer (let's say 10) into a string and assign it to a variable? A) var_name = string(10) B) var_name = Str(10) C) var_name = String(10) D) var_name = str(10) D) var_name = str(10)
Let's say I had the string "2023-09-15" assigned to a var named "date". How would I quickly get the day as an int? A) my_var = date.split('-')[2] B) my_var = int(date.split('-')[2]) C) my_var = date.split('-').int([2]) D) my_var = date.split('-')[2] B) my_var = int(date.split('-')[2])
How do you concatenate (add) two strings? A) "Hello" + "World" B) Hello + World C) "Hello + World" D) "Hello" .. "World" A) "Hello" + "World"
How do you stop a for loop before it finishes? A) end B) stop C) quit D) break D) break
How do you reverse a list? A) reverse(my_list) B) reversed(my_list) C) my_list.reverse() D) my_list.reverse B) reversed(my_list)
How would you create an empty list variable? A) my_list = [] B) my_list = () C) my_list = list() D) my_list = list[] A) my_list = []
How do you create a for loop where each value is assigned to a repeating variable name? A) each var_name in my_list: B) var_name in my_list: C) my_list for each var_name: D) for var_name in my_list: D) for var_name in my_list:
How do you create a for loop where you iterate over a range of numbers (say 1-9)? A) range(index, 9) B) for index in range(1, 10) C) for index in range(1, 9) D) for index, range(1, 10) B) for index in range(1, 10)
How would I do an if check to see if my_var stars with "TEST"? A) my_var.startswith("TEST"): B) if (startswith(my_var, "TEST")): C) if (my_var.startswith("TEST")): D) if startswith("TEST", my_var): C) if (my_var.startswith("TEST")):
How do you create an empty dict? A) empty_dict = {} B) empty_dict = dict{} C) empty_dict = dict() D) empty_dict = () A) empty_dict = {}
Say we had a dict named my_dict which contained {"breed": "beagle"} - how would we access the "beagle" value? A) my_dict["beagle"] B) my_dict("beagle") C) my_dict["breed"] D) my_dict("breed") C) my_dict["breed"]
Say we had two strings assigned to vars string1 and string2 - how do we check if string2 contains string1? A) if (string2 contains string1): B) if (string2 in string1): C) if (string1 is in string2): D) if (string1 in string2): D) if (string1 in string2):
How do we check if a string variable - say my_string - has a length less than 3? A) if (length(my_string) < 3): B) if (len(my_string) < 3): C) if (my_string.len() < 3): D) if (my_string.length() < 3): B) if (len(my_string) < 3):
How do we add a value to a list? A) my_list.append("value") B) my_list.add("value") C) add(my_list, "value") D) append(my_list, "value) A) my_list.append("value")
Created by: haypro
Popular Computers sets

 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards