Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Simple Coding Exercise

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Simple Coding Exercise. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Exela Smart Office utilities need a small formatting helper that produces a standard alphabet and a multiplication table for a requested size. Implement a function that returns both results in a predictable structure.

Given a positive integer n, return a dictionary with:

  1. alphabet: the uppercase English alphabet from A through Z as one string.
  2. table: a two-dimensional list where row i - 1, column j - 1 contains i * j for 1 <= i, j <= n.

The multiplication table should use one-based values, so the first row contains 1, 2, ..., n and the first column contains 1, 2, ..., n.

Constraints

  • 1 <= n <= 100
  • The alphabet contains exactly 26 uppercase English letters.
  • The multiplication table has n rows and n columns.

Function Signature

def generate_alphabet_and_table(n):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output