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

Task 11

Write a Python program which takes a number and prints the digits from the unit place, then the tenth, then hundredth, etc. (Right to Left)

[Consider the input number to be an INTEGER. You are not allowed to use String indexing for solving this task]

Example: If the user gives 32768, then print 8, 6, 7, 2, 3


Write a python function that accepts a list of numbers and try to find out the value of a ‘magic index’. The ‘magic index’ is calculated as the ratio of the largest and smallest list element. The python function Magic_Index(A) Take a list of elements and return the value of the magic index or error message for any possible exceptions. The error message will be "error occurred = error name".


 

Example-1

Example-2

 Example-3

Input:

[1, 2, 0]

 

Output:

Division Error: division by zero

Input:

[1, 2, 3, 6]

 

Output:

6.0

Input:

[1, 2, 0, "x"]

 

Output:

Other Error: '>' not supported between instances of 'str' and 'int'



Write a FaceConnect program that has the ff module:

  • script module that'll let the user enter password and username, if username is "X" or "x", program will exit. if username and password are correct, a welcome message and the menu will be displayed. Otherwise, prompt for username and password again. program must perform view, add or delete friend function depend on input.
  • a myLogin module that retrieves the information of the user given username and password.
  • a manageData module that will allow the retrieval, adding and deleting of friend(s).


NOTE: ALL info must be saved in text files.

The ff are the textfiles:


userCredentials - where the data of registered users will be written.

Format:

username;password;firstname;lastname;birthdate

e.g

prettyME;1234;Rhea;Tortor;12/25/1990


Each user has its own textfile where his/her friend(s) info will be written. use the username as the filename of each file.


The content of each file follow below format:


username1;[username2];[username3];


A company is offering a special discount to its customers based on an algorithm. Two range values are fed to the algorithm and in return t will calculate the discount to offer to the customers. The discount is calculated as the sum of all the prime numbers within the defined range including the range values if the range values are the prime numbers










Write an algorithm to find the special discount given to the customers










Input










The first line of the input consists of










an integer-rangelet remeng










the minimum boundary wabererte










given range

Find perimeter of a matrix


Input1:


1 2 3


4 5 6


7 8 9


Output: 40


Input2:


1 2 3 4


5 6 7 8


9 10 11 12


13 14 15 16


Output: 102

Ram is given a positive integer N. He wishes to convert this integer into a single numeral . He does so by repeatedly adding the numerals of the number until there is only a single numeral . Help Ram by providing the single - numeral number finally obtained .


Input

The input is a single line containing a positive integer N.


Output


The output should be a single line containing a single-numeral number.


Explanation


In the example, the given number is 545.

As the number is more than a single numeral, repeatedly add the numerals like


5 + 4 + 5 => 14

1 + 4 => 5


So, the output should be 5.



Sample Input 1

545

Sample output 1

5


Sample Input 2

111

Sample output 2

3


Write a BMI calculator program using loop control, user-defined functions include list, arithmetic and decision control statements with the following conditions :

1) Prompt user to enter the weight in kilogram and height in metres up to 2 decimal places

2) Use the given formula to calculate the Body Mass Index (BMI) and round it to 2 decimal place

BMI = Weight / Height?

3) Create two data list namely, "name list" to store the username and the "bmi list" to store the calculated BMI respectively.

4) With the given BMI category, the program code is able to display the following:

a) Allow user to enter name, weight and height.

b) The username, the BMI value and the category that it falls into.

c) The usernames in the name list and the respective BMI values in the bmi_list.

BMI category are as follows

Less than 18.5

Underweight

18.5 to 24.9

Normal

25 to 29.9

Overweight

30 to 34.9

Obese class

35 to 39.9

Obese class Il

40 to 49.9

Morbid Obese

50 or greater

Obese class IlI


A company is offering a special discount to its customers based on an algorithm. Two range values are fed to the algorithm and in return t will calculate the discount to offer to the customers. The discount is calculated as the sum of all the prime numbers within the defined range including the range values if the range values are the prime numbers









Write an algorithm to find the special discount given to the customers









Input









The first line of the input consists of









an integer-rangelet remeng









the minimum boundary wabererte









given range finding the p









values)

A company is offering a special discount to its customers based on an algorithm. Two range values are fed to the algorithm and in return t will calculate the discount to offer to the customers. The discount is calculated as the sum of all the prime numbers within the defined range including the range values if the range values are the prime numbers











Write an algorithm to find the special discount given to the customers











Input











The first line of the input consists of











an integer-rangelet remeng











the minimum boundary wabererte











given range finding the p











values)

Develop a python code to accept two numbers from the user to check whether those number



are divisible by both 3 and 5 or not .