[go: up one dir, main page]

0% found this document useful (0 votes)
2 views5 pages

Work Sheet

The document outlines an assignment for a computer programming course, detailing rules for problem-solving without using built-in functions or external resources. It includes a list of programming tasks to be completed, such as converting grades, checking even/odd numbers, and implementing algorithms for various calculations. The assignment must be submitted by June 12, 2025, in a specific file format and structure.

Uploaded by

lisita6489
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views5 pages

Work Sheet

The document outlines an assignment for a computer programming course, detailing rules for problem-solving without using built-in functions or external resources. It includes a list of programming tasks to be completed, such as converting grades, checking even/odd numbers, and implementing algorithms for various calculations. The assignment must be submitted by June 12, 2025, in a specific file format and structure.

Uploaded by

lisita6489
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Computer Programming: Assignment (10%):

🚫 Please read the instructions carefully. Any form of deviation from these rules
will not be tolerated.👇👇

• Rules:-

●​ Solve each problem independently.​

➔​ No module imports or built-in functions like min(), max(), sum(),


etc.​

➔​ Use only what you’ve learned in class so far.​

➔​ Submit each problem as a separate .py file.​

➔​ Compress all into a .zip only named: ID_section.zip and submit.​


✅ example: UGR/0000/17_section1.zip​
●​ Submitting someone else's work as your own.​

●​ Copying and pasting code from the internet or another student.​

●​ Using any AI tools such as ChatGPT, to generate solutions.​

●​ Plagiarism of any kind is strictly prohibited.

• Deadline:-

June 12, 2025 — 12:00 PM (Thursday before class). (Click to Use the Google Form)​


Computer Programming Worksheet
Develop an algorithm for each of the following problems. Use flowchart and pseudocode
method of developing an algorithm. An algorithm that:

2.​ Converts a mark for a course to its corresponding letter-grade. (You may set your own
scale for the grading)
3.​ Checks if a number is EVEN or ODD.
4.​ Counts and displays the number of even and odd numbers in the list [1,2,3,…,15].
5.​ Finds the minimum and maximum of two given numbers.
6.​ Finds the minimum and maximum numbers from a given list of numbers.
7.​ Write a program that prints the number of days in a month when the user enters the name
of the month. Use lists to group months that have the same number of days.
8.​ Displays the next day’s date, given today’s date.
9.​ That accepts two numbers and displays the product, sum, and difference of the two
numbers.
10.​That reads a number and prints the sum of the integers up to the number, i.e.​
1+2+3+4+…+n
11.​That reads a number n and prints 2n.

Write a program that implements the following algorithm:​


1. Start

○​ Read the total hours the employee has worked, TotalHours


○​ Read the hourly rate of pay for the employee, HourlyRate
○​ GrossSalary=TotalHours×HourlyRate
○​ Tax=GrossSalary×0.1
○​ NetSalary=GrossSalary−Tax
○​ Display NetSalary​
Stop

2. Write a program to find the last prime number occuring before the entered number.
Example: input a number to find the prime number occurs before the number 50.
47 is the last prime number before 50.

3.​ Write a program that calculates and displays the area and the circumference of a circle
based on its radius entered from the keyboard.
4.​ Write a program that swaps the values of two variables and displays their former and
current values. The values of the variables are to be entered from the keyboard.
5.​ Write a program that tells whether a number entered from the keyboard is an even or an
odd number.
6.​ Write a program that tells whether a number entered from the keyboard is a positive
number or a negative number or zero.
7.​ Write a program that tells whether a character entered from the keyboard is in uppercase
or in lowercase or neither.
8.​ Write a program that accepts a character entered from the keyboard and tells whether it is
a digit or a letter or a special symbol.
9.​ Write a program that converts a temperature given in Fahrenheit into Celsius and vice
versa. The program should distinguish temperature entered from the keyboard as in
degree centigrade or as in degree Fahrenheit by the letters ‘c/C’ or ‘f/F’ that must be
written in front of the numeric values of temperatures.​
For example: If the user enters 10 c or 10 C, the program must understand that the input
is in degree centigrade so it should change to degree Fahrenheit and must display the
temperature as 50 f or 50 F.
10.​Write a program in Python to list non-prime numbers from 1 to an upper bound.​
Example output: Input the upper limit: 25

The non-prime numbers are: 4 6 8 9 10 12 14 15 16 18 20 21 22 24 25

11.​ Write a program in Python to display the first n terms of the Fibonacci series.
12.​Write a program in Python to display the number in reverse order.​
Sample output: Input a number: 12345

The number in reverse order is: 54321


13.​Write a program in Python to display the pattern like a right-angle triangle using an
asterisk.​
Output:

**

***

****

*****

14.​Write a program in Python to display the pattern like a right-angle triangle with numbers.​
Output:

12

123

1234

12345

15. (Lucky Number Detector)

A number is lucky if it is divisible by 7 or ends with the digit 7.

➔​ Write a function that returns True if a number is lucky.


➔​ Read an integer and print whether it’s lucky or not.
16. (Sum Until Stop)

Repeatedly ask the user for numbers until they type stop. Print the total sum of the
numbers entered.

➔​ Use only while loops and conditionals.


➔​ Handle invalid (non-numeric) inputs gracefully using a check before converting.

17. Print a hollow square of stars using nested for loops. The user provides the size n (n
≥ 3), which represents both the height and width of the square.

Example for n = 5:

➔​ Use only while loops and conditionals.


➔​ Handle invalid (non-numeric) inputs gracefully using a check before converting.

18. (Password Validator)

Ask the user to enter a password. Check and print "Valid"

if:

➔​ It’s at least 6 characters long


➔​ It has no spaces
➔​ It contains at least one digit (hint: use a loop to check each character)
➔​ Otherwise, print "Invalid"

You might also like