LearnFrenzy
Sign in Take a free test

Python Basics and Syntax · Exercise 4 of 4

Python Basics and Syntax Python Basics Coding Problems

  • 10 questions
  • Page 1 of 1
  • Answers explained
0Attempted
0Correct
0Wrong
Directions

Beginner Python programs that use print(), input(), variables, arithmetic and f-strings. Write each one yourself first, then open the solution – every solution was run on Python 3, the output shown is the real output, and Run opens it in the online Python compiler.

Question 1 Easy

Read a name and an age, then print a greeting and how old the person will be next year.

Question page & discussion
Question 2 Easy

Read the principal, the annual rate (%) and the number of years, each on its own line, and print the simple interest and the total amount, to two decimal places.

Question page & discussion
Question 3 Easy

Read a radius and print the area and circumference of the circle, rounded to two decimals. Use the value of π from the math module.

Question page & discussion
Question 4 Easy

Read two values a and b, swap them without a third variable and print them before and after.

Question page & discussion
Question 5 Easy

Print a table of Celsius temperatures from 0 to 100 in steps of 25, with the Fahrenheit value of each, aligned in two columns.

Question page & discussion
Question 6 Medium

Read a number of seconds and print it as hours, minutes and seconds in HH:MM:SS form.

Question page & discussion
Question 7 Medium

Read three integers typed on one line, separated by spaces, and print their sum and average (two decimals).

Question page & discussion
Question 8 Medium

Read the units consumed. The charge is ₹6.50 per unit plus a fixed charge of ₹75, and a 5% tax on the total. Print the energy charge, tax and bill amount.

Question page & discussion
Question 9 Easy

Read a number and print its multiplication table from 1 to 10 in the form 7 x 1 = 7.

Question page & discussion
Question 10 Hard

Read a full name such as sachin ramesh tendulkar and print the initials in capitals with dots, and a username made of the first name and the length of the full name.

Question page & discussion
All exercises doneBack to Python Basics and SyntaxRevise the concepts or pick another topic

Ready to test your Programming?

Timed online tests with instant scores and explanations.

Search LearnFrenzy

Esc

Quick links