Answers by visitors named: Rambo

Just don't hate on us going to Jiksha and we can still learn from being given the answers. As long as we understand the lesson after this and get that A+ we gucci
Tysm bro
To send a value out of a function, you use the ___ keyword. return def if send
Functions allow us to reduce repetition to follow the ___ principle. D.E.F. D.R.Y. D.I.Y. D.R.I.
You use the ___ keyword to create a function. create def fun if
Function ___ allow functions to take in a value from the function caller. values variables parameters definitions
What is the standard indentation amount in function definitions? 4 spaces 2 spaces 3 spaces 0 spaces
A while loop runs until a boolean condition becomes ___. True bool None False
What type of looping did we cover today? determinate definable indefinite continuous
The boolean condition that controls a while loop is called the loop-___ condition. continuation interpretation situation determination
What are the two types of looping in computer programs? definite and indefinite definable and indefinable infinite and determinate continuous and halting
Python's while loop is generally used to perform ___ looping. continuous determinate definable indefinite
An infinite loop happens when the boolean condition that controls a while loop never becomes ___. bool None False True
What would be a good initial value for a score in a game? 1 None of the above 100 0
Variables that track important data in a game are known as game ___. variables state scores loops
How can we represent the value of dice (or coin faces) in Python? None of the above Using bool values Using random numbers Using images
What function did we use to simulate rolling dice in today's app? print() float() input() int()
___ is whether a number is even or odd. Equity Rarity Parity Arity
How did we use the D.R.Y. principle in this lesson? We generalized repetitive code by moving it into a function. We removed the game loop to reduce repetition. We didn't use the D.R.Y. principle in this lesson. We removed buggy logic from our program.
The function is_logged_in() is an example of a ___. Boolean helper function Expression helper function Refactoring helper function Debugging helper function
How did we use refactoring in this lesson? We removed code from functions and put it into the main program area. We debugged a broken project and fixed it. We moved complicated logic into functions and tried to follow the D.R.Y. principle. We didn't use refactoring in this lesson.
Why do we need refactoring? Because it is required. It helps the computer to read our code. We don't need refactoring. It helps other programmers (or our future selves) work with our code.
Which sentence best-describes the process of refactoring? None of the above. A way to debug. A way to improve the structure and readability of your code. A way to make your code easier for the computer to read.
___ helper functions make a boolean expression into a named function. Expression Debugging Boolean Refactoring
To add items to a list, you can use ___. list.add() list.put() list.in() list.append()
In Python, you generally use a list to hold ___ items. zero single multiple two
A list is known as a ___ structure. code data list storage
The ___ operator let's you test if an item is contained in a list. list == in =
___ are special functions that allow you to manipulate a list through dot notation. Functions Data Methods Structures
Today, we learned how to use ___ conditional statements. simple complex big multiple
Python's ___ operator evaluates to True whenever either conditional expression is True. either and or not
___ data entered by a user ensures your program behaves as you expect it to. Creating Storing Removing Validating
Use the ___ operator to get the remainder after division. % // / \
The > operator is an example of a ___ operator. comparison logical complex boolean
A ___ loop is generally used to perform definite repetition. for slow fast while
When you build a list from another list, the technique is called a ___. building cloning wrapping mapping
The step-by-step approach we used to search through lists with a for loop today was called an ___. algorithm logarithm aphorism syllogism
Definite loops run for a ___ number of times. predicated preferred prehistoric predetermined
If we want to loop through a list of foods, how would we do it with the for loop? for foods: # do something with the food for food in foods: # do something with the food for foods in foods: # do something with the food for foods in food: # do something with the food
___ must be unique in a dict. keys indices values lists
How would we determine if the item "tacos" was in a menu dict? if "tacos": # do something if menu in "tacos": # do something if "tacos" in menu: # do something if in menu "tacos": # do something
What is the correct syntax to access the value (the taco's price) that the key "tacos" references in a menu dict? taco_price = menu[tacos] taco_price = menu{"tacos"} taco_price = menu[taco_price] taco_price = menu["tacos"]
Which line below shows how to loop through a menu dict's key/value pairs (the key is the menu item and the value is the price of the item)? for price, item in menu.items(): # do something with the item and price for item price in menu.items(): # do something with the item and price for item, price in menu.items(): # do something with the item and price for [item, price] in menu.items(): # do something with the item and price
How would you update the price of a taco to be 4.50 in a menu dict? Assume the key is the item name and the value is the item's price. tacos[menu] = 4.50 menu[tacos] = 4.50 menu[4.50] = "tacos" menu["tacos"] = 4.50
What data structure did we use to represent the three valid choices in today's project? dict list variable str
What keyword is used to create a function in Python? if def fun str
What keyword is used to exit a loop? end continue exit break
The ___ loop is useful for indefinite looping. forever def while for
The ___ loop is used to loop over a list for while forever def
Given a users dict that maps usernames to email addresses, how would you get the email address for the user djs? email_address = users[0] email_address = users{"djs"} email_address = users["djs"] email_address = users("djs")
How do you increment the value stored in a variable called score by 1? score++ score += 1 1 += score score+
How do we get a random key from a menu_items dict using the random module's choice() function? random_menu_item = choice(menu_items.keys()) random_menu_item = choice(menu_items.items()) random_menu_item = choice(menu_items) random_menu_item = choice(menu_items.values())
What dict method lets you loop through both the key and the value of the dict in a for loop? dict.keys() dict.get() dict.items() dict.values()
Which of the following methods gets the keys from a dict and lets you use them like a list? dict.choices() dict.val() dict.convert_to_list() dict.keys()
How do we get a random key from a menu_items dict using the random module's choice() function? random_menu_item = choice(menu_items.keys()) random_menu_item = choice(menu_items.items()) random_menu_item = choice(menu_items) random_menu_item = choice(menu_items.values())
What does DRY stand for?* Don’t Repeat Yourself Do Repeat Yourself Don’t Recall Yourself Don’t Revise Yourself
What is the output of the following code snippet?* def say_something(): print("I said something") def print_something(): print("I printed something") print_something() I said something I printed something I said something I printed something None of the options
Which of the following built-in functions returns the length of a list?* length() min() len() max()
Which of the following is not a relational operator?* >= != == +=
8. In the following code snippet, what should go in the ___ to loop through the `users` list?* users = ["Daniel", "Ivann", "Natalie", "Kevin"] for user in ___: print(users) user users list None of the options
Write a Python program based on these instructions:* Create a `Funny Nickname` app. This app should ask the user for their first name and then create a nickname in the form "[nickname] [first_name]" Hints: - Import the function to choose a random item from a list. - Create a list of at least 4 possible nicknames of your choosing. - Prompt the user for their first name. - Combine their first name with a random nickname from the nicknames list. - Display their name/nickname with a message like: "What's up [nickname] [first_name]!" - You should replace anything in [] with the value of the variables.
Write a Python program based on these instructions:* Create a program that prompts a user to repeatedly guess a number. Keep a tally of how many guesses it takes them to guess the number. Once they guess the number, tell them how many guesses it took and end the program. Hints: - Generate a random number. - You should use a function to do this so it's truly random - Create a variable to track the `number_of_guesses`. - Create an indefinite loop. - Inside the loop: - Prompt the user to guess the random number. - If the user's guess is the same as the random number. - Display a message saying: "That's correct, it took [number_of_guesses] for you to guess the number!" - You should replace [number_of_guesses] with the value of the variable. - Exit the loop. - If the user's guess is NOT the same as the random number. - Display a message saying: "Sorry, try again!". - Add one to the `number_of_guesses`.
If we have a list named colors, which of the following gives the length of the list?* colors.length() len(colors) colors.len() length(colors)
What is the output of the following code snippet?* for num in range(5): print(num) 1 2 3 4 5 0 1 2 3 4 5 1 2 3 4 0 1 2 3 4
Which keyword is used to create a function in Python?* function def define fun
Which keyword is used to send data out of a function?* push return send take
Which operator is used to multiply two numbers?* % / * &
Find & fix the syntax error(s) in the following code:* fruits = [ "Apple", "Banana", "Orange" "Watermelon ] for fruit from fruits print(fruit))
Write a Python program which:* - Creates a function called `add()` that takes two parameters: `num1` and `num2`. - Return the sum of the numbers from the `add()` function. - Prompts the user for number 1 and stores their response in a variable - Don't forget to convert to the correct data type! - Prompts the user for number 2 and stores their response in a variable - Don't forget to convert to the correct data type! - Uses the `add()` function to get the sum of the two numbers and stores it in a variable called `total`. - Displays a message like: "[num1] + [num2] = [total]" - You should replace each [] with the value of the variable it represents.
Write a Python program that:* - Prompts a user for a number and stores the response in a variable called "user_number". - Make sure to convert the user input to the correct data type. - Multiplies the user's number by 10 and stores the result in a variable called "product". - Displays: "[user_number] * 10 = [product]" - You should replace [user_number] and [product] with the value of the appropriate variables.
Write a Python program that:* - Stores animal names in a list and then prints all of the values inside it using a `for` loop. - You should have at least 4 animal names in your list. - After the loop, display the total number of animals in the list. - You should use a function to do this. - The output should be something like: "There are __ animals in my list" - Replace the __ with the number of animals in the list.
Which of the following is the correct syntax to define a dictionary:* user_details = { "djs", "admin" } user_details = { "username": "djs", "role": "admin" } user_details = [ "username": "djs", "role": "admin" ] user_details = { "username", "djs" : "role", "admin" }
Which function is used to remove an item from a dictionary?* dict.remove() dict.delete() dict.pop() dict.destroy()
Which function is used to get all of the keys from a dictionary?* dict.keys() dict.values() dict() None of the options
Which of the following is a data structure?* int list float bool
Which data type is returned by the `input()` function?* str int float It depends on what the user enters when they respond to the `input()` function
What is the index number of "tacos" in this list:* foods = ["tacos", "burritos", "nachos"] 1 0 3 2
What is the index number of "steve" in this list:* users = ["daniel", "jim", "steve"] 2 3 4 0
Write Python program which checks if a user is in the correct height range to ride a roller coaster. You should:* - Create a function called `check_height()` - It should take one parameter,`height`, which is a float - In the `check_height()` function: - If the `height` is less than 5.2 or more than 7.5, display: "You cannot ride the roller coaster". - If the`height` is between 5.2 and 7.5 (inclusive), display: "You can ride the roller coaster". - In the main area of your program: - Prompt the user for their height and store their response in a variable. - Don't forget to convert to the correct data type! - Use the `check_height()` function with the user-provided height to see if they can ride the roller coaster.
Which example imports the `randint()` function from the `random` module?* from random import randint() from randint import random from random import randint from randint() import random
Which data structure stores items in key/value pairs?* dict list str bool
Which value represents a `bool`?* 0 {} True []
40. Would the following code print something?* num = 5 if num == 0 or num == 1: print("The number is 0 or 1") Yes, it prints the following text: "The number is 0 or 1" No, there's an error so an error message would be displayed
Write a Python program that:* - Creates an empty list called `favorite_foods`. - Creates a loop that runs three times. - In the loop: - Prompt the user for their favorite food - Add the user's response to the `favorite_foods` list - After the loop, use another loop to display the user's favorite foods in this form: Your favorite foods are: - tacos - burritos - nachos
Write a Python program which:* - Creates a variable to hold an `admin_username` with whatever username you wish. - Creates a variable to hold an `admin_password` with whatever password you wish. - Prompts the user for a `username`. - Prompts the user for a `password`. - Checks if the `username` and `password` provided by the user are the same as the `admin_username` and `admin_password`. - If they are the same, display: "Welcome admin!" - If they are not the same, display: "Sorry, those credentials are incorrect!"
Find & fix syntax error(s) in the following code:* meaning_of_life == input(What is the meaning of life? ) if meaning_of_life = programming print("That's correct!) else: print("That is incorrect, try again!")
Write a Python program that:* - Creates a list of `wizards` with these values: - "Daniel", "Sam", "Sahib", "Ivann" - Prompts the user to guess a wizard's name - Store their response in a variable called `wizard_name` - If the user guesses a wizard in your `wizards` list, display: "That's correct! [wizard_name] is a wizard! - Replace `wizard_name` with the name the user guessed - If the user didn't guess a wizard in your `wizards` list, display: "Sorry, [wizard_name] is not a wizard." - Replace `wizard_name` with the name the user guessed
What is the main goal of a debate?(1 point) Responses to learn about a topic to learn about a topic to reach a consensus to reach a consensus to contribute information to contribute information to present a winning argument
What is a collegial discussion?(1 point) Responses a type of project where each student has a specific assigned role a type of project where each student has a specific assigned role a mutually respectful conversation between students in a classroom a mutually respectful conversation between students in a classroom a chance for students who disagree to work out their differences a chance for students who disagree to work out their differences a formal event where each student is given a set amount of time to talk
What kind of question can be used to help propel a collegial discussion?(1 point) Responses a question that can be answered by looking up a fact a question that can be answered by looking up a fact a question that changes the topic of the discussion a question that changes the topic of the discussion a question that relates the discussion to a bigger idea a question that relates the discussion to a bigger idea a question that leads everyone to a specific conclusion
What is empathy?(1 point) Responses understanding others’ feelings even if you do not agree understanding others’ feelings even if you do not agree learning about others’ feelings even if you do not understand them learning about others’ feelings even if you do not understand them telling others about your feelings even if you think they do not understand telling others about your feelings even if you think they do not understand sharing others’ feelings even if you once felt differently sharing others’ feelings even if you once felt differently
Thanks
you're wrong
you're still wrong
1. How long would it take to fly a jet to the Sun from earth? 18 years 18 hours 1 year 24 hours
2. Which of the following is correct about Sirius? It is the brightest star in the night sky. It is not as bright as Canopus. It can only be seen with a telescope. It is smaller than our sun.
Use this table to answer questions about the spectral features of each of the stars: Sirius has a temperature of 9,940K. Using the table above, what spectral features does Sirius have? Helium, some hydrogen Strong hydrogen, some ionized metals Hydrogen and ionized metals such as calcium and iron Both metals and ionized metals, especially ionized calcium
How far away from Earth is Kapteyn's Star? 38 light years 20 light years 13 light years 1 light year
5. It is a spectral type M star. Using the table above, what spectral features does Kapteyn's Star have? Helium, some hydrogen Strong titanium oxide and some calcium Hydrogen and ionized metals such as calcium and iron Both metals and ionized metals, especially ionized calcium
What kind of star is Luyten's star? red dwarf red giant white dwarf neutron star