Skip to content

Update 100+ Python challenging programming exercises.txt #153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
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)
#----------------------------------------#