629 Answered Questions for the topic Python

how to write an exponent function in python?

Write a function that takes two integers and raises the first number to the power of the second number and returns the result.

how to write an average function in python?

Write a function that takes three arguments (numerical) and returns the average of the numbers entered.

How to write a tax function in python?

Write a function that takes the price of the item as an argument and return the price calculated with a tax value of .07. The goal here is to convert the tax calculation into a reusable function.

02/07/23

How do i make a menu in python

HI how do I make am menu in python? I need a menu that has too options and both options lead to a different menu.

how to go about coding this in python?

Write a function that asks for the user to enter a number of items they wish to purchase.

how would you write this in python?

Write a function that asks for the age of the user’s dog. Print a string that states the dog’s age in dog years with a conversion rate of 1 human year to 7 dog years.

how to code this in python

Write a function that asks for the user’s name and prints “Hello, “ followed by their name.

how to type a tuple

How do you type the tuple value that has just the integer value 42 in it?t = (42)t = (42,) (The trailing comma is mandatory.)t = (), .insert(42)t = [42,]

multiple choice for python

What is the main difference between a dictionary and a list?A list can contain a dictionary however a dictionary cannot contain a list.There is no difference.The items stored in a dictionary are... more

how to use set to return Mississippi in python

Write an expression that would turn the string "Mississippi" into a set of unique letters.For example:set("Parallel") would return set {"P", "a", "e", "l", "r"}You should only write one line of... more

how to code this in python?

in python: Using keys and indexing, grab the "hello" from the following dictionaries:6a.d = {'simple_key':"hello"}6b.d = {"k1":{"k2":"hello"}}

how to code this in python

In python: Reassign "hello" in this nested list to say "goodbye" instead:list1 = [1, 2, [3, 4, "hello"]]

how to code this in python

Create a dictionary of technical terms and allow the user to lookup the definitions of these terms from the dictionary. Use the following list for your dictionary:'dict', 'list', 'map', or... more

how to use comma code in python

Comma CodeSay you have a list value like this:characters = ["Thor", "Thanos", "Black Panther", "Iron Man", "Hulk", "Batman", "Captain America"]Write Python code that coverts the list into a string... more

how to code this in python

you are creating a fantasy video game. The data structure to model the player’s inventory will be a dictionary where the keys are string values describing the item in the inventory and the value is... more

how to merge dictionaries in python

in python: Create the same dictionary as in exercise 3 but also create a second dictionary with only the season of Winter. Use the dictionary.update method to merge the winter dictionary into the... more

How to use dictionary in python

in python: Create a dictionary of the seasons Fall, Spring and Summer where the name of the season is the key and the value is a list of the months in that season. Print the value of "Fall".

how to do dictionaries in python

In python: Use any names and birthdays you want to create a birthday dictionary that has four entries. The name is the key and the value is the birth date. Print each birth date by using the key... more

How to slice the following code

In python:Use the slicing syntax of lists to get every other entry in the following list starting at the beginning and print the results.['a','b','c','d','e','f','g']Sample output:['a', 'c', 'e', 'g'] more

how to slice in python

In python: Use the slicing syntax of lists to get the first 4 numbers in the following list and print out the results.[1,2,3,4,5,6,7,8,9]

How to get a list of str and turn them to ints to add

Use the string.split method create a list of numbers from the following string and then sum up the numbers. Print the sum to the screen.'90,67,87,102,77,80'

01/25/23

Python function help

I have to write this same basic function six different times, changing the formula in the function each time. I need help getting the first function right. we have a prompt like this for each of... more

How would I start this program

I have def ted_fruit(fruit,fruit_quantity,fruit_cost). Ted, the TA, wants to buy fruit from the grocery. Define a function named ted_fruit(fruit, fruit_quantity, fruit_cost) that takes in the name... more

Code troubleshooting

Fruit_List = ["apple", "pear", "peach", "banana"] Fruit_Name = input("Enter Fruit of Choice Here: ") Fruit_Count = 0 for Fr in Fruit_List: if Fr.lower() == Fruit_Name.lower(): ... more

01/23/23

To add a curve to the amount of grades being printed.

Code in python. Given the following list of student test scores, apply a class "curve" to each score. The class curve is as follows: 90 or above: no curve80 to 90: +2 points70 to 80: +5 pointsLower... more

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.