Your Perfect Assignment is Just a Click Away

We Write Custom Academic Papers

100% Original, Plagiarism Free, Customized to your instructions!

glass
pen
clip
papers
heaphones

University of The Cumberlands Python Programming Questions

University of The Cumberlands Python Programming Questions

Question Description

TASK TWO: OPERATORS AND DECISION MAKING STATEMENT

1.Write a program in Python to perform the following operation:

  • If a number is divisible by 3 it should print “Consultadd” as a string
  • If a number is divisible by 5 it should print “c” as a string
  • If a number is divisible by both 3 and 5 it should print “Consultadd Python Training” as a string.

2. Write a program in Python to perform the following operator based task:

  • Ask user to choose the following option first:
    • If User Enter 1 – Addition
    • If User Enter 2 – Subtraction
    • If User Enter 3 – Division
    • If USer Enter 4 – Multiplication
    • If User Enter 5 – Average
  • Ask user to enter the 2 numbers in a variable for first and second for the first 4 options mentioned above.
  • Ask user to enter two more numbers as first1 and second2 for calculating the average as soon as user choose an option 5.
  • At the end if the answer of any operation is Negative print a statement saying “zsa”
  • NOTE: At a time user can perform one action at a time.

3. Write a program in Python to implement the given flowchart:

4. Write a program in Python to break and continue if the following cases occurs:

  • If user enters a negative number just break the loop and print “It’s Over”
  • If user enters a positive number just continue in the loop and print “Good Going”

5. Write a program in Python which will find all such numbers which are divisible by 7 but are not a multiple of 5, between 2000 and 3200.

6. What is the output of the following code examples?

  • x=123

for i in x:

print(i)

  • i = 0

while i < 5:

print(i)

i += 1

if i == 3:

break

else:

print(“error”)

  • count = 0

while True:

print(count)

count += 1

if count >= 5:

Break

7. Write a program that prints all the numbers from 0 to 6 except 3 and 6.

Expected output: 0 1 2 4 5

Note: Use ‘continue’ statement

8. Write a program that accepts a string as an input from user and calculate the number of digits and letters.

Expected output: consul12

Letters 6

Digits 2

9. Read the two parts of the question below:

  • Write a program such that it asks users to “guess the lucky number”. If the correct number is guessed the program stops, otherwise it continues forever.
  • Modify the program so that it asks users whether they want to guess again each time. Use two variables, ‘number’ for the number and ‘answer’ for the answer to the question whether they want to continue guessing. The program stops if the user guesses the correct number or answers “no”. ( The program continues as long as a user has not answered “no” and has not guessed the correct number)

10. Write a program that asks five times to guess the lucky number. Use a while loop and a counter, such as

counter=1

While counter <= 5:

print(“Type in the”, counter, “number”

counter=counter+1

The program asks for five guesses (no matter whether the correct number was guessed or not). If the correct number is guessed, the program outputs “Good guess!”, otherwise it outputs “Try again!”. After the fifth guess it stops and prints “Game over!”.

11. In the previous question, insert “break” after the “Good guess!” print statement. “break” will terminate the while loop so that users do not have to continue guessing after they found the number. If the user does not guess the number at all, print “Sorry but that was not very successful”.

Order Solution Now

Our Service Charter

1. Professional & Expert Writers: Course Elite only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Course Elite are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Course Elite is known for timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Course Elite, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.