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

Getting error in this line of code



new_matrix[k][j] = 0




Please help!

Write a program using pseudocode to store your name, class, section in a text file.



Task:

Write a program which will take an input from the user and search it in a built in

array using the linear search algorithm.

For Example:

BuiltInArray = [Apple, Orange, Grape, Strawberry, Blueberry, Mango]

UserInput = Mango

Output: The input found and the index number is 5

UserInput = Rice

Ouput: Input is not available in the array


INCORRECT SOLUTION:

FruitArray= ["Apple", "Orange", "Grape", "Strawberry", "Blueberry", "Mango"]

FruitSearch=input("Enter fruit to search")

c=0

while c<len(FruitArray):

    

    if FruitArray[c]==FruitSearch:

        print (FruitSearch, "found in index number", c)

    

    if FruitArray[c]!= FruitSearch:

        c = c + 1

print (FruitSearch, "is not available in the array")


****MY QUESTION: What to correct in the program to stop printing for infinite times if fruit is found?


Using pseudocode, declare an array called ‘marks’ that will hold the following four values: 20, 60, 30, 90


Write the pseudocode for an application that will prompt a user for a numeric value and then search for the value provided in the mark array


Use an if.. else statement and write a program that asks the user for input of the time in hours (1 to 24) for the day. if the time value is greater than 6 and less than 18, then the program must output a comment. 'Have a Happy Day', else the comment must be 'Rest Well' please bane the program and provide at least one code comment

There are M number of boys, N number of girls and P number of pets given. A pet race is held for a fun-filled Sunday in a town. Each pet animal is accompanied by two persons for the race. The organiser planning for the seating arrangements by making groups such that each group has three members, and among these members, there is at least one boy and at least one girl, the third member being a boy, a girl, or a pet. One bench is required for each such group. The task is to find the maximum number of benches required for this

What is the value of f(3456) for the function below?

def f(x):
    d=0
    while x >= 1:
        (x,d) = (x/7,d+1)
    return(d)






Draw a flowchart to represent the following nested loop: set count = 0 set page = 0 while page < 5      while count < 6             output “I can do this”             set count = count + 1       endwhile      set page = page + 1 endwhile output page


question 1)  input gender, age: old enough for army (age+male) by using AND

question 2) input if student took swe234, ddf160, bty123, Ptr223: if took any of    them, then finished Group C by using OR

question 3)Loops:
for:  15..20, 10..1, evens 2..20; print 1..10 on 1 line 

question 4) sum of the evens
question 5) sum of the odds
question 6) find the max
question 7) find the min
question 8) input 5 numbers and calculate

I want very simple code
LATEST TUTORIALS
APPROVED BY CLIENTS