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

Sum of N terms in Harmonic series

Given integer 

N as input, write a program to display the sum of the first N terms in harmonic series.

The series is: 1 + 1/2 + 1/3 + 1/4 + 1/5 ... + 1/N (N terms).

Input

The first line of input is an integer 

N.

Output

Print the sum rounded upto 2 decimal places.

Explanation

For 

N = 5

The sum of first 5 terms in harmonic series is 1 + 1/2 + 1/3 + 1/4 + 1/5

So, the output should be 

2.28.

Sample Input 1
5
Sample Output 1
2.28
Sample Input 2
3
Sample Output 2
1.83

def character_element(n):
  import string
  if n in string.ascii_letters:
    print('Letter')
  elif n in string.digits:
    print('Digit')
  else:
    print('Special Character')

The Above code have two test cases, but they were not getting any expected output even one test case also. Please give me expected output. Thank you !

Question url link :-

https://drive.google.com/file/d/1iGIZxhoPoL67KNkroEgQpaIo3Vh8w7dE/view?usp=sharing

The test cases are below

Sample Input 1

9

Sample Output 1

Digit


Sample Input 2

A

Sample Output 2

Uppercase Letter


LARGEST PALINDROME

you are given an integer N . find the largest palindrome which is less than N .


INPUT

the input contains a single integer

OUTPUT

the output should be a single integer which is the largest palindrome that is less than the given input.

EXPLANATION

given N = 45

44 is the largest number which is a palindrome that is less than 45

SAMPLE INPUT 1

45

SAMPLE OUTPUT 1

44

SAMPLE INPUT 2

79

SAMPLE OUTPUT 2

77


You are given a positive integer N. Your task is to find the number of positive integers K <= N such that K is not divisible by any of the following numbers 2, 3, 4, 5, 6, 7, 8, 9, 10.


With Explanation too!


Question 1:

Finder program

# Dict, list, queue

# directory --- os.walk()

list1 = [c:, d:, e:]

dict1 = {}

def func(drive)

resp = os.walk(drive)

statem1

st

dict1[file] = path

for drive in list1:

#th1 = Thread(target= func(drive))

#th1.start()

func(drive)

# apply join

finding total time of execution #

dict ---> pickle

Please help me to get the solution for this
Number of digits until N

Given an integer 

N, write a program that prints the count of the total number of digits between 1 and N.

Input

The input is a positive integer.

Output

The output should be a single line containing the count of the digits up to the given number.

Explanation

Given 

N = 10

From 1 to 9, each number contains a single digit. From 10 onwards, the numbers contain two digits.

So the output should be 9 + 2 = 

11.

Sample Input 1
10
Sample Output 1
11
Sample Input 2
4
Sample Output 2
4

sample input 3
1000
sample output3
2893




Question 1:

write a program to find the given string in the root directory that contains a text file

1. In a recursive manner (case in sensitive )

2. only in the root directory

use command line arguments.

program_name -ri string root_dir (recursive)

program_name -si string root_dir (root director )

The output which file and line contains the string


Question 1:

Finder program

# Dict, list, queue

# directory --- os.walk()

list1 = [c:, d:, e:]

dict1 = {}

def func(drive)

resp = os.walk(drive)

statem1

st

dict1[file] = path

for drive in list1:

#th1 = Thread(target= func(drive))

#th1.start()

func(drive)

# apply join

finding total time of execution #

dict ---> pickle


Question 1:

How to make object as callable video __call__

from collections import Counter

class MyCounter(Counter):

Add here required code so that we can give data to object like co1("intel")

co1 = MyCounter()

co1("intel")


Given

rows = 4

cols = 3

matrix = 1 2 3

4 5 6

7 8 9

10 11 12


output : 1 2 3 6 5 4 7 8 9 12 11 10


Explination : Every alternative row should be in reverse order.


LATEST TUTORIALS
APPROVED BY CLIENTS