Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update 100+ Python challenging programming exercises.txt
Added a challenge from hackerrank (30 Days of Code) that is quite easy for anyone.
  • Loading branch information
Rohit-beep-droid authored May 24, 2021
commit 2c387b46707ccba7773ec42ee202361057370e4e
37 changes: 37 additions & 0 deletions 100+ Python challenging programming exercises.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2371,5 +2371,42 @@ solutions=solve(numheads,numlegs)
print solutions

#----------------------------------------#
Level: Easy

Question:
Given an integer n, print its first 10 multiples. Each mutiple should be printed on a new line.

(Credit: HackerRank (30 Days of Code))

Example:

n = 2

2 x 1 = 2
2 x 2 = 4
2 x 3 = 6
2 x 4 = 18
2 x 5 = 10
2 x 6 = 12
2 x 7 = 14
2 x 8 = 16
2 x 9 = 18
2 x 10 = 20

Answer:

import math
import os
import random
import re
import sys

# Imports not necessary but provided

if __name__ == '__main__':
n = int(input().strip())
for i in range(1,11):
print(n,"x",i,"=",n*i)
#----------------------------------------#