02.PB Python Conditional Statements Lab
02.PB Python Conditional Statements Lab
Problems for lab exercise for the "Programming Basics" course @ SoftUni Global
Submit your solutions to the SoftUni Judge system: https://judge.softuni.org/Contests/4579
1. Excellent Result
Write a console program that reads a rating (integer) entered by the user and prints "Excellent!" if the score is 5 or
higher.
Check the value of the grade. If it is greater than or equal to 5, print the conditional output
2. Start the program with [Ctrl + Shift + F10] and test it with different input values:
2. Greater Number
Write a program that reads two integers entered by the user and prints the larger of the two.
5 5 3 5 10 10 -5 5
3 5 10 5
3. Compare whether the first_number is greater than second_number. Print the larger number.
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
3. Even or Odd
Write a program that reads an integer entered by the user and prints whether it is even or odd.
3. Check that the number is even by dividing it by 2, and check what the remainder of the division is. Print the
output depending on the condition:
4. Password Guess
Write a program that reads a password (string) entered by the user and checks if the entered password matches the
phrase "s3cr3t!P@ssw0rd". In case of coincidence, display "Welcome". In case of discrepancy, display "Wrong
password!".
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
6. Speed Info
Write a program that reads the speed (floating-point number) entered by the user and prints speed information.
At speed up to 10 (inclusive) print "slow"
At speed between 10 and 50 (inclusive) print "average"
At speed between 50 and 150 (inclusive) print "fast"
At speed between 150 and 1000 (inclusive) print "ultra fast"
At a higher speed print "extremely fast"
7. Area of Figures
Write a program in which the user enters the type and dimensions of a geometric figure and calculates its area. The
figures are of four types: square, square, rectangle, circle, and triangle. The first line of the input reads the type of
figure (string with the following options: square, rectangle, circle, or triangle).
If the figure is a square: on the next line read a floating-point number - the length of its side
If the figure is a rectangle: on the next two lines read two floating-point numbers - the lengths of its sides
If the figure is a circle: on the next line read a floating-point number - the radius of the circle
If the figure is a triangle: on the next two lines read two floating-point numbers - the length of its side and
the length of the height to it
Round the result up to 3 digits after the decimal point.
© 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.