0% found this document useful (0 votes)
5 views3 pages

L3a - Problems

The document outlines a series of Python programming problems designed for learning and assessment, categorized by difficulty. Each problem includes specific requirements for input and output formats, covering a range of topics such as age calculation, basic arithmetic operations, unit conversions, and conditional logic. The problems aim to progressively build programming skills through practical exercises.

Uploaded by

tanqueray
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)
5 views3 pages

L3a - Problems

The document outlines a series of Python programming problems designed for learning and assessment, categorized by difficulty. Each problem includes specific requirements for input and output formats, covering a range of topics such as age calculation, basic arithmetic operations, unit conversions, and conditional logic. The problems aim to progressively build programming skills through practical exercises.

Uploaded by

tanqueray
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/ 3

Informatics 1

PROBLEMS - Lesson 3: Python Basics

Problems in yellow → Assessable problems (evaluable)


The rest of the problems are of intermediate difficulty. If you have any difficulty moving
from one recommended problem to the next one, do some of the problems that appear
in between for more progressive learning.

Problem 1
Write a program that reads the birth year of a person and computes his/her age in 2025.
Print the result. The format will be: "You will be XX years old in 2025." where XX is an
integer number.

Problem 2
Write a program that checks if an input number is lower or equal to 10. Format: "The
result is: X" where X is a boolean with value True if the number is <= 10, and False if it
is greater than 10.

Problem 3
Write a program to know if an input number is within the open interval (0,10), which
means that it does not include these endpoints (so, greater than 0 and lower than 10).
Output format: "The result is: X" where X is a boolean with value True if the number is
withing the interval, False otherwise

Problem 4
Write a program to know if a 2D point (x,y) is within a square of size 10 and origin (0,0).
Check if these numbers are >=0 and <=10. Output format: "Result is: X" where X is a
boolean with value True if the point is within the square, False otherwise.

Problem 5
Make a program that asks the user to enter the size of the side of a square. The program
should calculate the area of the square and display it on the screen.

Problem 6
Make a program that calculates the price of a trip knowing that each kilometer is paid at
2 €. The program must ask the user to enter the number of kilometers of the trip via
keyboard and display the final cost of the trip on the screen.

Problem 7
Make a program that converts distances from meters to kilometers. The program will ask
the user what the distance in meters is, make the conversion to kilometers and show the
result of the conversion by screen.
Problem 8
1
Informatics 2

Write a program that converts an amount in dollars to euros. Change to be used: 1 dollar
= 0.892439 euros. Format of the message: "DD dollars are EE euros" where DD and EE
are two real numbers.

Problem 9
Make a program that reads an employee’s initial salary and calculates the new salary as
the increase of 8% over the initial salary.

Problem 10
Given an amount in banknotes of 5, 10 and 20 euros (entered by the user via keyboard)
make a program that calculates and shows the total amount.

Problem 11
Write a program that reads 3 grades (real numbers) and computes the mean. Output
Format: “The mean of the grades N1 N2 N3 is MM” where MM is the mean. All numbers
are real.

Problem 12
Make a program that asks the user to enter the base and height of a triangle. The
program must calculate the area of the triangle and display it on the screen.

Problem 13
Write a program that converts Celsius to Fahrenheit degrees (real numbers). The output
format is: “CC Celsius degrees are FF Fahrenheit degrees” where CC and FF are real
numbers. The formula for conversion is:
9
f = c + 32
5
Problem 14
Make a program that asks the user to enter two integers via keyboard, and calculate the
addition, subtraction, multiplication, and division, and display the four results.

Problem 15
Write a program that reads an integer x and computes:
2
a) x −4

b) 1 + 4 − x
3  ( x + 3)

Show two lines “Result: XX” where XX is a real number (with decimals). Format:
"Result:AA
Result: BB".
2
Informatics 3

Check the result when we enter a value x that makes the denominator = 0.

Problem 16
Make a program to resolve disputes at birthday parties where cakes are to be distributed
among attendees. The program must ask for the number of cakes to be distributed and
the number of people attending the party to be entered by keyboard. Then indicate how
many cakes each of the attendees will have and how many will be left over. Cakes must
be divided into whole units (cannot be divided into parts).

Problem 17
Write a program that computes the thousand units of an input (integer) number. Output
format: “The thousand units of NN are MM” where NN and MM are two integer numbers.
For example: The thousand units of 105 are 0, The thousand units of 2405 are 2, The
thousand units of 134605 are 4

Problem 18
Write a program that reads the user name, surname and age (integer). Then, the
program computes his/her age next year using "_" instead of blanks. The output format:
"Hi_NNNN_CCCC_next_year_you_will_be_XX_years_old." where NNNN is the name,
CCCC the surname and XX the age.
For example, if the user is Maria Alsina, 33 years old, the output will be:
“Hi_Maria_Alsina_next_year_you_will_be_34_years_old.”

Problem 19
Write a program that prints the ASCII code of an input character.

Problem 20
Write a program that reads an input number x (between 0 and 200) and shows the
character that corresponds to this number in the ASCII table. Next, it will show the
character that has the code x+1 and then x+10. A blank space will separate the three
characters. Output: Three characters, separated by blank.

Problem 21
Write a program that reads three input number (x,y,z) and computes:
a) (x < 7) and ((y > z) or (7 > z))
b) ((x == 99) and (y < -5)) and ((z >= 100) or (z < 6))
c) ((9 >= x) and (13 < y)) or (-36 >= z)
Output format: "Result: A B C" where A, B and C are booleans with values True or False.

You might also like