01.PB Python First Steps in Coding Lab
01.PB Python First Steps in Coding Lab
01.PB Python First Steps in Coding Lab
Problems for lab exercise for the "Programming Basics" @ SoftUni Global
Submit your solutions to the SoftUni Judge system at: https://judge.softuni.org/Contests/4577
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
7. Write the following code (command for printing the text"Hello SoftUni"):
print('Hello SoftUni')
8. Start the program by pressing: Alt + Shift + F10 or right click in the code field -> Run
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
Send your solution using the button Submit. You will receive the result within a few seconds in the table with sent
decisions in the judge system:
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
3. Area of a rectangle
Write a console program that receives two integers (the sides of rectangle a and b) and calculates the area of a
rectangle with these sides.
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
Caution: depending on the regional settings of the operating system, a decimal point (US settings) may be used
instead of a decimal point (BG settings). If the program expects a decimal point and a decimal place or reverse
number is entered (a decimal point is entered when a decimal point is expected), an error may be made.
We recommend that you change your computer's settings to use a decimal point:
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
5. Greetings by Name
Write a program that reads text from the console (person's name) and prints "Hello, <name>! " where <name>
name is entered from the console.
Guidelines
1. First create a new PyCharm file named greeting
2.Create the variable name and keep in it the name you will read from the console using input():
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
6. Concatenate Data
Write a program that read from the console name, family, age and town and prints the following message: "You
are <firstName> <lastName>, a <age>-years old person from < town>."
4. Start the program with Ctrl + Shift + F10 and test with different input examples:
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
7. Projects Creation
Write a program that calculates how many hours it will take an architect to prepare the projects on several
construction sites. The preparation of a project takes three hours.
Input
2 lines are read from the console
1. Name of the architect - text
2. Number of projects to be prepared- integer in the interval [0 … 100]
Output
Print on the console:
"The architect {architect name} will need {needed hours} hours to complete {projects
count} project/s."
George The architect George will John The architect John will need 27
need 12 hours to complete hours to complete 9 project/s.
4 9
4 project/s.
8. Pet shop
Write a program that calculates the necessary costs for the purchase of food for dogs and cats. Food is shopped at a
pet store, with a pack of dog food priced at 2.50 USD and a pack of cat food costing 4 USD.
Input
2 lines are read from the console:
1. The number of packages of food for dogs – integer in the interval [0… 100]
2. The number of packages of food for cats – integer in the interval [0… 100]
Output
Print on the console:
"{end sum} USD."
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
9. Yard Greening
Sophia has several houses on the Black Sea coast and wants to green the yards of some of them, thus creating a
cozy atmosphere and comfort for its guests. She has hired a company for this purpose.
Write a program that calculates the amount needed for Sophie to pay to the project contractor. The price per
square meter is 7.61 USD including VAT. Because her yard is quite large, the contractor company offers an 18%
discount on the final price.
Input Data
One line is read from the console:
1. Square meters of the landscaped – a floating-point number in the range [0.00 … 10000.00]
Output Data
Two lines are printed on the console:
"The final price is: {final price of the service} USD."
"The discount is: {discount} USD."
550 The final price is: 3432.11 We calculate the price for landscaping the whole yard:
USD.
550 * 7.61 = 4185.50 USD.
The discount is: 753.39 USD.
We deduct the discount (18% = 0.18) from the total:
0.18 * 4185.5 = 753.39 USD.
We calculate the final price of the service:
4185.50 – 753.39 3432.11 USD.
150 The final price is: 936.03 USD. We calculate the price for landscaping the whole yard:
The discount is: 205.47 USD. 150 * 7.61 = 1141.50 USD.
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.