Python programme comparing for and while loops, Python Programming

Assignment Help:

1)    Write a python programmecomparing for and while loops like the following.

Math Times table

For Loop:

2x1=2

2x2=4

.....

2x12=24

While Loop:

3x1=3

3x2=6

....

3x12=36

2)    Write a program that simulates the Math method 'pow'. The program will read real Values as input and calculate the value as power of the input value (Use math library). This will then output to screen as following two examples:

Input of 3, should return 9.

Input of 4, should return 16.         

3)    Write a programme that calculates:

a)    How much an amount deposited in a bank account at r% annual interest has grown to after one, two and three years.

b)    The general formula for computing the amount including after n years is: Kn= k0 *(1+r/100)n

4)    Create a dog years programme to calculate the number of human years corresponds to the dog's age. The programme with accept the age of the dog as an input.

a)    A one year old dog roughly corresponds to 14 years old child.

b)    A dog that is two years old corresponds to 22 years old human.

c)    Every further dog year corresponds to five human years.

Example:

Enter the age of the dog: 5

The human age in years is 37

5)    Write a program that reads a sequence of integers from a file and prints a frequency report showing how many times the integers 0 to 9 occurs in the sequence.

Example of input data is 4, 5, 4, 2, 8, 9, 1, 0, 3, 6, 8, 9, display the number of occurrence for each integers from 0 to 9.

6)    Write a program that reads a line of text from the keyboard, and display after replacing each occurrence of any four-letter word in the text with the word "x***", where x is the first character in the four-letter word.

Example:Input : "This apple tree is the best"

Display output: "T*** apple t*** is the b***"

7)    Write a class Employee that stores the employee number, name, position and salary. Include the Constructor, Accessor and Mutator methods.No output required.

8)    Include in the question 8 the four methods, the following methods to reset salary, increase and decrease the salary and to print the current salary. No output required.

9)   Write a program that uses paired array. The task is to match the grade with the cutoff percentage mark.

a)    The first list (array) represents all the student grades (F2, F1, P1, P2, C, D, HD)

b)    The second list (array) holds the corresponding cutoff percentage mark required (45, 50, 55, 60, 65, 75, 85).

c)    The program should prompt and read a percentage value as input.

d)    The corresponding grade is output to the screen.

10) Write a program that reads a list of twenty integers from a file and stores them in an array.

a)    The program should print the position of the smallest number in the array.

b)    If the position of the smallest number is other than 0, the program should swap the number in position 0 with the smallest value.

c)    After swapping, the smallest number is now in position 0 and the number that was previously in position 0 is now where the smallest number was.

d)    Finally the program should print the values in the array.

Part BA glossary of at least 30 programming terms of your choice.

Correct use of Harvard Referencing Methodin both in-text and reference lists. (A glossary must be in alphabetic order.)

Expand this grid yourself and use Microsoft Word.

Programming COM101    Portfolio 1101

Term

Definition

Reference (In-text)

algorithm

A sequence of instruction a that can be used to carry out a task

Mount, Shuttleworth& Winder 2008

 

 

 

 

 

 


Related Discussions:- Python programme comparing for and while loops

Expressions and assignment, Expressions and assignment We can think of...

Expressions and assignment We can think of most computer programs as performing some sort of transformation on data.  Our code may get as input the exam scores of everyone in

Foundation of programming, hi i want to make a assignmnt of foundation of p...

hi i want to make a assignmnt of foundation of programming which include 4 task. I just want to know how much will be the price for that

Data wrangling, Ask quesICT702 TASK 2 1 2018 Semester 2 Data Wrangling Due ...

Ask quesICT702 TASK 2 1 2018 Semester 2 Data Wrangling Due in two parts - Friday of Week 9 and Week 12 Below Zero - ice cream store The local ice-cream store needs a new ordering s

Python programming, Suppose the cover price of a book is $24.95, but bookst...

Suppose the cover price of a book is $24.95, but bookstores get a 40% discount. Shipping costs $3 for the first copy and 75 cents for each additional copy. What is the total whol

Python programs, Python Programs You must submit the source code and s...

Python Programs You must submit the source code and samples of output for each program.Please do not provide python file (eg. Filename.py). Copy all source code to one word fi

Example of python code, Worked example 1   Let's examine what  happens...

Worked example 1   Let's examine what  happens when  we compute the following Python code:   def p(x, y): z = x*x - y return z + 1/z   >>> p(1.0, 2.0) -2.0

Non-local references in procedures, Non-local references in procedures ...

Non-local references in procedures There  is an important subtlety in the  way  names  are handled in the  environment created by a function call. When  a value  that  is not

Question, Data array A has data series from 1,000,000 to 1 with step size 1...

Data array A has data series from 1,000,000 to 1 with step size 1, which is in perfect decreasing order. Data array B has data series from 1 to 1,000,000, which is in random order.

Python Program Help, Write a Python program to accomplish the following. U...

Write a Python program to accomplish the following. Use modular design. Include at least 3 functions: one that returns zero values, one that returns one value, and one that retu

Help, When investing money, an important concept to know is compound intere...

When investing money, an important concept to know is compound interest. The equation FV = PV (1+rate)periods . This relates the following four quantities. The present value (

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd