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

Create a sequence of numbers from 15 to 25 and increment by 4. What is the index of the value 19


What is h(60)-h(45), given the definition of h below?




def h(n):




s = 0




for i in range(2,n):




if n%i == 0:




s = s+i




return(s)

A company wants to transmit data over the telephone, but it is concerned that its phones may be tapped. All of its data are transmitted as four-digit integers. It has asked you to write a program that will encrypt its data so that the data may be transmitted more securely. Your script should read a four-digit integer entered by the user in a prompt dialog and encrypt it as follows: Replace each digit by (the sum of that digit plus 7) modulus 10. Then swap the first digit with the third, and swap the second digit with the fourth. Then build the script that displays the encrypted integer.

def cels_to_fahr(cels):

'''

convert Celsius-Fahrenheit

'''

return (cels*9/5) + 32


I have a Question about this symbol (''')(''') what it mean in this code and what their function??


write a program that:

  • asks the user to input the width and height of a rectangle
  • calculates the area
  • outputs the result

Write a program to take in the roll number, name and percentage of marks for n students of





Class X. Write user defined functions to:





1. accept details of the n students (n is the number of students)





2. search details of a particular student on the basis of roll number and display





result





3. display the result of all the students





4. find the topper amongst them





5. find the subject toppers amongst them





(Hint: use Dictionary, where the key can be roll number and the value is an immutable data





type containing name and percentage)

part 2:


The function should return the number of winners (i.e., the number of participants whose lucky draw number is a multiple of factor-digit and contain the must-have-digit).


Your advised to write a helper function contain_digit(number, digit) that returns True if number contains digit, or False otherwise. Example, function call contain_digit(15, 5) returns True. This function will be called by the find_winners(factor, must_have, n) function to check existence of must_have digit.



part 1: Citizens-of-Zakadaha-hold-an-annual-Gagalafa-festival-to-celebrate-the-harvest-of-their-prized-produce, the-well-sought-after-cocoa-beans-Kokomoko. A-lucky-draw-is-held during-the-festival. Every-participant-is-given-a-lucky draw number. Each year, the organizer decides on two non-zero digits, the factor-digit and the must-have-digit. These two digits need not be distinct. A winning lucky draw number is a number that is a multiple of the factor-digit and contains the must-have-digit. Note that there could be more than one lucky draw winner.

Write function find_winners(factor, must_have, n) that accepts the three parameters:

  1. The factor-digit (factor), a non-zero digit (1-9).
  2. The must-have-digit (must_have), a non-zero digit (1-9).
  3. The number of participants (n) where the lucky draw numbers will be numbered from 1 to n (inclusive).

Write a user-define function, called AreaOfCircle, that calculates and prints the area of a circle given its radius as input using Python input () function.

Note: You want to use the proper arithmetic operations, calculate, and print the proper value for the scenario described below:

At the beginning of your code, you need to use math module, ask for the radius of the circle. Then calculate the area of the circle and print the result using a proper message. For example, the area of the circle is …  


write a program to make palindromes


LATEST TUTORIALS
APPROVED BY CLIENTS