Skip to Content
Practice CornerBasic Input/ Output and Operators

Input(), Print(), and Operators

Understanding how to take input, details output, and use basic operators is essential for programming. These are the building blocks to create dynamic and interactive programs. Here are some beginner-friendly exercises to get you started.

Practice Problems

Problems Index

  1. Input marks in 3 subjects and find the total and percentage.
  2. Input name, hobby, and age, then print them as a paragraph.
  3. Take a string and repeat it n times (using *).
  4. Input two numbers and print them separated by a custom separator.
  5. Print a message on one line and another message on the same line using the end argument.
  6. Input marks in two subjects and calculate their average.
  7. Input the length and breadth of a rectangle and calculate its area.
  8. Input the cost of an item and the quantity purchased, then calculate the total cost.
  9. Input two numbers and swap their values using a temporary variable.
  10. Input the base and height of a triangle and calculate its area.

Try It Yourself

Now that you’ve reviewed the problems, practice them below using the code runner!

1. Total and Percentage

PygroundTry It Out

Input marks in 3 subjects and find the total and percentage.

Output:

2. Personal Details

PygroundTry It Out

Input name, hobby, and age, then print them as a paragraph.

Output:

3. Repeat String

PygroundTry It Out

Take a string and repeat it n times (using *).

Output:

4. Custom Separator

PygroundTry It Out

Input two numbers and print them separated by a custom separator.

Output:

5. Print with End

PygroundTry It Out

Print a message on one line and another message on the same line using the end argument.

Output:

6. Average Marks

PygroundTry It Out

Input marks in two subjects and calculate their average.

Output:

7. Rectangle Area

PygroundTry It Out

Input the length and breadth of a rectangle and calculate its area.

Output:

8. Total Cost

PygroundTry It Out

Input the cost of an item and the quantity purchased, then calculate the total cost.

Output:

9. Swap Values

PygroundTry It Out

Input two numbers and swap their values using a temporary variable.

Output:

10. Triangle Area

PygroundTry It Out

Input the base and height of a triangle and calculate its area.

Output:

Last updated on