LearnFrenzy
Sign in Take a free test

Python Built-in Functions · Exercise 4 of 4

Python Built-in Functions Built-in Functions Coding Problems

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

Short Python programs that solve real tasks almost entirely with built-in functions. 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

For a sentence, print the number of words, the longest and shortest word, the average word length and the words in alphabetical order (case-insensitive).

Question page & discussion
Question 2 Medium

Each row holds a student's marks in three subjects. Use zip(*rows) to get each subject's marks, then print the total and topper per subject.

Question page & discussion
Question 3 Easy

From (product, price, quantity sold) records, print the top 3 products by revenue with their rank.

Question page & discussion
Question 4 Medium

Remove duplicate city names regardless of case, keeping the first spelling in its original position.

Question page & discussion
Question 5 Easy

Convert numbers given as text in any base (with 0b, 0o or 0x prefixes, or plain decimal) to all four bases.

Question page & discussion
Question 6 Medium

A registration is valid when all required fields are filled, the age is a number from 16 to 60, and at least one contact (email or phone) is given. Print the result and the missing fields for each form.

Question page & discussion
Question 7 Medium

From daily closing prices, compute each day's change (zip the list with itself shifted by one), the biggest rise and the number of days the price fell.

Question page & discussion
Question 8 Easy

Find the most frequent vote and how many votes it got, and list the options from most to fewest votes – using only built-ins (no collections).

Question page & discussion
Question 9 Medium

Encrypt and decrypt a message by shifting letters with chr and ord, wrapping around the alphabet and keeping case and other characters.

Question page & discussion
Question 10 Medium

Attendance is a string of P and A per student for 10 days. Print each student's attendance percentage, the students below 75%, and on which day numbers everyone was present.

Question page & discussion
All exercises doneBack to Python Built-in FunctionsRevise the concepts or pick another topic

Ready to test your Programming?

Timed online tests with instant scores and explanations.

Search LearnFrenzy

Esc

Quick links