Python Answers

Questions answered by Experts: 5 288

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

# Various Icecream flavors
menu_item1 = "Chocolate"
menu_item2 = "Vanilla"
menu_item3 = "Strawberry"

order = input("\nWhich flavors would you like on your icecream today?\n\n" +
              "\n".join([menu_item1, menu_item2, menu_item3]) + "\n\n")

# Convert input to list of flavors.
order = order.lower().split()
plural = "s" if len(order) > 1 else " "
print("\nYou have selected " + ", " .join(order) + " flavor" + plural)


Question 3: For lines 22-24, how do I include an "and" word to always be included for 2 or more flavors regardless if I respond to the input code with "Chocolate Vanilla Strawberry" or "Chocolate Vanilla and Strawberry"?


Example Output: You have selected Chocolate, Vanilla and Strawberry flavors


My Output: You have selected Chocolate, Vanilla, Strawberry flavors


# Various Icecream flavors
menu_item1 = "Chocolate"
menu_item2 = "Vanilla"
menu_item3 = "Strawberry"

order = input("\nWhich flavors would you like on your icecream today?\n\n" +
              "\n".join([menu_item1, menu_item2, menu_item3]) + "\n\n")

# Convert input to list of flavors.
order = order.lower().split()
plural = "s" if len(order) > 1 else " "
print("\nYou have selected " + ", " .join(order) + " flavor" + plural)


Question: For lines 22-24, how do I hide the comma's when responding to the input code with choosing 2 or less flavors?


Example Output: You have selected Chocolate and Vanilla flavors


My Output: You have selected Chocolate, and, Vanilla flavors


# Various Icecream flavors
menu_item1 = "Chocolate"
menu_item2 = "Vanilla"
menu_item3 = "Strawberry"

order = input("\nWhich flavors would you like on your icecream today?\n\n" +
              "\n".join([menu_item1, menu_item2, menu_item3]) + "\n\n")

# Convert input to list of flavors.
order = order.lower().split()
plural = "s" if len(order) > 1 else " "
print("\nYou have selected " + ", " .join(order) + " flavor" + plural)


Question: For lines 22-24, how do I add a comma for just the first flavor when responding to the input code with choosing 3 or more flavors?


Example output: You have selected Chocolate, Vanilla and Strawberry flavors


My Output: You have selected Chocolate, Vanilla, and, Strawberry flavors


# You work at a low latency trading firm and are asked to deliver the order book data provided in order_book_data.txt to a superior

# The problem is that the data isn't formatted correctly. Please complete the following steps to apropriately format the data

1. Open order_book_data.tx

3. Get rid empty lines

4. Get rid of spaces

5. Notice that there are two currencies in the order book; USD and YEN. Please convert both the Bid and Ask price to USD

6. Create a header line ['Symbol,Date,Bid,Ask']

7. Save the header line and properly formatted lines to a comma seperated value file called mktDataFormat.csv


Write a program to print W pattern of N lines using a asterisk(*) character


NOTE : There is a space after each asterisk (*) character.



Input:


The first line is an integer N



Explanation:


For N=5


The output should be


* * * * * * * * *


* * * * * * * *


* * * * * *


* * * *


* *

program to print the first prime numbers in the given input


Sample Input 2

4

2

3

5

7

Sample Output 2

2


Sample Input 1

5

1

10

4

3

2

Sample Output 1

3



can i get coode for this the above code is not working for both cases



program name: String lookup

input: plays

3

Raju is going to school

Teja plays cricket

car has four wheels


output: 2


Enter integer here: 5

. . . . 0 . . . .

. . . 0 0 0 . . .

. . 0 0 0 0 0 . .

. 0 0 0 0 0 0 0 .

0 0 0 0 0 0 0 0 0

. 0 0 0 0 0 0 0 .

. . 0 0 0 0 0 . .

. . . 0 0 0 . . .

. . . . 0 . . . .


can i get code for this please,

using for loop


write a python function that accepts the value of two integers a and b and produces the output as (a+b)/(a-b). As he is still a kid, hence might not be able to enter the values correctly. Write a python function Divide_Op(a,b) (Refer RollNo_W10A_3.py) which produces the appropriate output or error message by handling all possible exceptions.

writing a python function Add_Values(a,b) (Refer RollNo_W10A_2.py)which takes either two integer or float or string input parameters and perform addition/concatenation if the type of both parameters is the same otherwise give an exception as shown in the example.

LATEST TUTORIALS
APPROVED BY CLIENTS