756 Answered Questions for the topic Python

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

01/23/23

indentation error

sentence = input("Enter a word:") vowel_count = 0 for i in sentence: if(i == "a" or i == "e" or i == "i" or i == "o" or i == "u"): vowel_count = vowel_count + 1 print("Total vowel count :",... more

01/23/23

How to do a for loop to do this

#3.2 Find the vowels – for loop (4.5 points)Using the 'if' statement and the 'or' operator, write a program that uses the input() function and asks the user for a word or sentence.Print the number... more
Python Computer

01/23/23

to write a code block on python that will answer the below

Write a simple "shopping cart" program that asks the user for a series of product prices. Compute sales tax (7%) on each price and print out the new price to the user. Next, ask the user if they... more
Python

01/22/23

how to write a program in python that takes the coin value entered and spits out what coin that is

Write a program that asks the user for the value of a coin. Then determine what kind of coin they entered using this information. 1 = “Penny”5 = “Nickle”10 = “Dime”25 = “Quarter”50 = “Half... more

How to code in python something that will take your inputs of items bought and add them with tax

Calculates the total including sales tax (8.875%) of a shopping trip.Create a total variable and a tax variable. Total the items calculated with tax. Be sure to test if the price is above... more

01/21/23

python programming

temperature = int(input("What temperature is the weather today?")) if temperature < 40: print("Wear a warm coat") elif temperature < 70: print("Wear a light jacket") elif temperature... more

01/18/23

How can I get it to divide decimals without it crashing

The program works fine with whole numbers, as soon as I enter a decimal like 2.5 it crashes. CLASS = str(input("What is the name of your class: "))HOURS = int(input("How many hours a week do you... more

01/18/23

How do I input a name from another input into a different input.

the program I have so farCLASS = str(input("What is the name of your class: "))HOURS = int(input("How many hours a week do you spend in", CLASS))Line 1 works, but lien two crashes it. I'm new to... more

01/17/23

Machine learning project

I want to create a machine learning project using python which takes data from a csv file or something similar and makes predictive charts and analysis. More details can be discussed later.
Python

01/15/23

Python3 Programming Problem

Write a program that takes two integer values a,n as command line arguments separated by spaces. The arguments denote a range [0,a-1] and a modulus n. Your program should generate 10000 random... more
Python

01/14/23

How to answer a Regular Expression

Run the regexp tokenizer with the regular pattern on the sentence “Mr. Black and Mrs. Brown attended the lecture by Dr. Gray, but Gov. White wasn’t there.”a. Design and add a line to the pattern of... 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.