Skip to content

Muhdal-Amin/CSC_120_pg9

Repository files navigation

CSC_120

Computer as a Problem solving tool : Page 9, Exercises 1 - 7

Exercise 1 (Name Printing)

Write a program that prints your name a hundred times.

Exercise 2 (Name Printing)

Write a program to fill the screen horizontally and vertically with your name. [Hint : add the option end="" into the print function to fill the screen horizontally].

Exercise 3 (Name Printing)

Write a program that outputs 100 lines, numbered 1 to 100, each with your name on it. The ouput should look like this;

1 Your name

2 Your name

3 Your name....

Exercise 4 (Computation)

Write a program that computes and prints the result of (512 - 282) / (47.48 + 5)

Exercise 5 (Squares of Numbers)

Write a program that prints asks the user to enter a number, then prints out the square of the inputted number. The program should use the sep optional argument to print it out in a full sentence that ends in a period. Sample output is shown below;

Enter a number: 5

The square of 5 is 25.

Exercise 6 (Multiples)

Write a program that asks the user to enter a number x. The program should use the sep optional argument to print out x, 2x, 3x, 4x and 5x. Each separated by three dashes as shown below;

Enter a number: 7

7---14---21---28---35

Exercise 7 (Weight Conversion)

Write a program that asks the user for a weight in kilograms and converts it to pounds. There are 2.2 pounds in a kilogram.

About

Control Structures in Python

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages