Questions: 5 831

Answers by our Experts: 5 728

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 & Filtering

A group of people are playing a game they are standing in a line, each carrying a card with a number on it. These numbers are given in the "A". One random number S is selected.

Find out new list of numbers after

S people are removed from left

S people are removed from right

Example [1,2,3] and S be 1

After removing from left [2,3]

After removing from right [1,2]

Output 23

        12


To give you direction:


  • Read the Input into a variable.


  • Now using the loop iterate in range 1 to input.


  • Again read the second input into the variable.


  • Now take the count to assign the value 0 to it.


  • Using loop condition iterate from range 1 to second input.


  • using the if condition checks the condition that the second input is divisible by number then increment the count.


  • If the count is equal to 2


  • print the number and break from the loop.


Example:

2

4

7

5

the output will be 2 it is the first prime number.


the code which you have sent did not the get the desired output



Write a program to solve a quadratic equation ax2 + bx + c = 0. Always check if the discriminant (D)

> 0, then the equations has two roots

= 0, then the equation has one root (two equal roots)

< 0, the equation has no real roots 

where    D = square root of b2 - 4ac


Write a Python program that asks the user for a range (a starting number and an ending number) and then counts how many numbers are prime numbers and how many numbers are perfect numbers between that range. It also prints those numbers in the format shown in the output of the example given below.


Hint (1): We may declare two strings/lists to store the prime and perfect numbers. Inside the loop, we check for prime and perfect numbers and add them to respective string/list besides counting them.


Hint (2): We may need to convert numbers in String to integers for checking and calculations. We may again need to convert numbers to Strings for storing and printing as the outputs shown in the example below.


Example: If the user gives us a range of between 2 and 6, there are 3 prime numbers (2, 3, 5) and 1 perfect number (6) in that range.


Input:

2

6


Output:

Between 2 and 6,

Found 3 prime numbers

Found 1 perfect number

Prime numbers: 2, 3, 5

Perfect number: 6


Write a function called propagateUncertainty() that accepts as input two variables in the format x = [x_best,dx] and y = [y_best,dy]. Have your function calculate the sum q = x + y as well as the corresponding max uncertainty dq = dx + dy and return an answer in the same format of the inputs (i.e., q = [q_best,dq]).


If either of the inputs does not have two entries, your function should return the string "Fail" and print the statement "Array length must be equal to two with the format x = [x_best,dx]."

If either of the inputs contains non-numeric entries (i.e., type(entry) is not equal to "int" or "float"), your function should return the string "Fail" and print the statement "Non-numeric entry!"



Define a function named "countCharacter" that accepts a sentence as parameter (string) and calculate the total number of letters, total number of uppercase letters, total number of lowercase letters, total number of digits and total number of characters that is not letter and not digit. The function will then return a list of 5 integers representing: 1. total number of letters 2. number of letters with uppercase 3. number of letters with lowercase 4. number of digits 5. any other character beside letters and digits Suppose the following input is supplied to the function "Hell0 WorlD!!!4567" the function will return a list with the following values [9, 3, 6, 5, 4]









Define a function named "isValidPassword" which take a string as parameter. The function will then check if the supplied string fulfilled the following password criterias: 1) must have combination of uppercase and lowercase 2) must have at least 3 digits 3) must have at least 2 special character (including whitespace). 4) must have at least 10 characters (combination of alphanumeric and special symbol) The function will return a Boolean value i.e. True if all criterias are met or return False otherwise. Make sure you test your function with every single possible input that may return False value as well.


Define a function named "excludeItem" which take two parameters (item1 & item2) and both

are list. This function will create a separate list named "result" which only include items found

in both lists. The result list should not have duplicate value.

For example, given item1 = [1,2,3,4,2,1] while item2 = [2, 4, 4, 2]. This function will return a

result of [2,4]. Note that the output value is unique (no duplicate). The function must be able

to accept other parameters as well i.e. list of strings or mixture of strings and digits


Given an array A of N integers and two integers X and Y, find the number of integers in the array that are both less than or equal to X and divisible by Y.

Create a Python script which will accept a positive integer and will determine the input number if PERFECT, ABUNDANT, DEFICIENT.


I need the code to have an output.


LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS