Starting from:
$30

$24

CSC1001-- Assignment 1 Solution

Question 1 solved

    1. This code is saved in 1_1.py

    2. This program allows the user to input the final account value, annual interest rate in percent and the number of years. The output would be the initial account value of money that has to be saved to obtain the final account value.

    3. These input numbers should be positive real numbers.

    4. Execute as followings:








Question 2

    1. This code is saved in 1_2.py

    2. This program allows the user to input a positive integer and displays each of its digits one by one (one digit per line).
    3. The input number should be a positive integer.

    4. Execute as followings:










Question 3

    1. This code is saved in 1_3.py

    2. This program allows the user to input a positive number. The output is the smallest integer n such that n**2 is greater than m.
    3. The input number should be a positive number.

    4. Execute as followings:







Question 4

    1. This code is saved in 1_4.py

    2. This program allows the user to input anything. But the table will only be printed if the input is a positive integer. The table with N rows and 3 columns. In the mth row, the program will output three numbers: m, m+1, and m**(m+1).

    3. The input can be anything. If it is not a positive integer, the program will remind you and make you input again.
    4. Execute as followings:

Question 5

    1. This code is saved in 1_5.py

    2. This program allows the user to input anything. But only numbers>2 will be given primes smaller than itself. The output is all the prime numbers which are smaller than the input. And the output at most 8 prime numbers in each line.

    3. The input can be anything. If it is a string or numbers<=0, the program will remind you to input a positive integer and make you input again. If it is 1 or 2, it will tell you that 1 or 2 has no prime smaller than itself and make you input again.

    4. Execute as followings:










Question 6

    1. This code is saved in 1_6.py

    2. This program allows the user to input anything. But only function==sin or cos or tan, initial point and end point==number, n==a positive integer, only in this case, the result will be printed. The output is the result of the equation:




    3. The input can be anything. But only correct format will be calculated, if you enter the wrong format, the program will remind you and make you enter again.
    4. Execute as followings:

More products