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

1. Finding Letters

by CodeChum Admin

We've already counted digits before on a certain number, so how about doing it on strings and characters? There's a catch, though, since you're only going to count and see if the character exists at least twice in a string.


Instructions:

  1. Create two variables and assign them to an input() function. The first variable shall accept a single letter and the second variable shall store the inputted string.
  2. Using loops, count the number of times that the single letter appears on the inputted string, and when it appears at least twice in the string, print "Cody is really awesome"; else, print "Cody rocks".
  3. Tip: to make your code more efficient, use the break keyword to terminate the loop whenever the count of appearance of the single letter has already reached 2.

Input

The first line contains a single-letter string.

The second line contains a string.

e
CodeChum·is·awesome

Output

A line containing a string.

Cody·is·really·awesome




Write a program that takes three numbers as input from the user, and prints the largest.

Sample Run

Enter a number: 20 
Enter a number: 50 
Enter a number: 5 

Largest: 50

Hint: Remember that the numbers should be compared numerically. Any input from the user must be transformed into an integer, but printed as a string.




Draw a flowchart and construct a python program to accept a list of N numbers. The job is to determine if there exists an element in the list such that the sum of the elements on its left is equal to the sum of the elements on its right. If such element exists, then print the index of the element. If there are no such elements, then the sum is zero. 


Find the number of digits between 1 to N

example:

  1. I/P = 10 O/P=11
  2. I/P=4 O/P=4
  3. I/P = 13 O/P=17
  4. I/P=111 O/P=225

and so on...


an e-commerce company is planning to give a special discount on all <b><i>its</i></b> products to its customers for the christmas holidays. input: 7 9-13 8-7 18-10 18 output: 2


def lucky_number(name):

  number = len(name) * 9

  ___ = "Hello " + name + ". Your lucky number is " + str(number)

  ___

      

print(lucky_number("Kay"))

print(lucky_number("Cameron"))


Describe how catching exceptions can help with file errors. Write three Python examples that actually generate file errors on your computer and catch the errors with try: except: blocks. Include the code and output for each example in your post.



Describe how you might deal with each error if you were writing a large production program. These descriptions should be general ideas in English, not actual Python code.

Given a number N, count the total number of digits from 1 to n


Draw a flow chart and construct a python program to accept a list of N numbers .the job is to determine if there Exists an element in the list such that sum of the elements on its left is equal to the sum of the elements on its right if such elements exists print index of elements.ifthere is no such elements then sum is zero


] Draw a flowchart and construct a python program to read the three subject’s marks secured by n students during FAT examination. If a student secured less than 50 in any subject, the student is failed in that subject. Count the number of students who failed in each subject and the total number of students who failed in at least one subject. [