JOC Using Python Week - 04 - Assignment - 04

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

02/07/2020 The Joy of Computing using Python - Course

(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)

[email protected]

NPTEL (https://swayam.gov.in/explorer?ncCode=NPTEL) » The Joy of Computing using Python (course)

Announcements (announcements)

About the Course (https://swayam.gov.in/nd1_noc20_cs35/preview) Ask a Question (forum)

Progress (student/home) Mentor (student/mentor)

Programming Assignment-3: Matrix


Course Due on 2020-02-27, 23:59 IST
outline
You are provided with the number of rows (R) and columns (C). Your task is to
generate the matrix having R rows and C columns such that all the numbers are
How does an in increasing order starting from 1 in row wise manner.
NPTEL online
course work? Input Format:
The first line contain two numbers R and C separated by a space.
Week 0
Output Format:
Week 1 Print the elements of the matrix with each row in a new line and elements of
each row are separated by a space.
Week 2
NOTE: There should not be any space after the last element of each row and
Week 3 no new line after the last row.

week 4 Example:
Practice is the Input:
key (unit?
33
unit=59&lesson=60)

Magic Square: Output:


Hit and Trial 01 123
(unit? 456
unit=59&lesson=61)
789
Magic Square:
Hit and Trial 02 Explanation:
(unit? Starting from the first row, the numbers are present in the increasing order.
unit=59&lesson=62) Since it's a 3X3 matrix, the numbers are from 1 to 9.
Magic Square:
Sample Test Cases
Hit and Trial 03
Input Output

https://onlinecourses.nptel.ac.in/noc20_cs35/progassignment?name=282 1/4
02/07/2020 The Joy of Computing using Python - Course

(unit?
unit=59&lesson=63) 1 2 3 4
5 6 7 8
Magic Square: Test Case 1 4 4
9 10 11 12
Hit and Trial 04
13 14 15 16
(unit?
unit=59&lesson=64)
1 2 3 4 5
Magic Square: 6 7 8 9 10
Hit and Trial 05
Test Case 2 5 5 11 12 13 14 15
(unit?
16 17 18 19 20
unit=59&lesson=65)
21 22 23 24 25
Let's program
and play (unit?
1 2 3 4 5 6 7 8 9 10
unit=59&lesson=66)
11 12 13 14 15 16 17 18 19 20
Dobble Game - 21 22 23 24 25 26 27 28 29 30
Spot the 31 32 33 34 35 36 37 38 39 40
similarity 01 41 42 43 44 45 46 47 48 49 50
(unit? Test Case 3 10 10
51 52 53 54 55 56 57 58 59 60
unit=59&lesson=67)
61 62 63 64 65 66 67 68 69 70
Dobble Game - 71 72 73 74 75 76 77 78 79 80
Spot the 81 82 83 84 85 86 87 88 89 90
similarity 02 91 92 93 94 95 96 97 98 99 100
(unit?
unit=59&lesson=68)
1 2 3
Test Case 4 2 3
Dobble Game - 4 5 6
Spot the
similarity 03
1 2
(unit?
unit=59&lesson=69) Test Case 5 3 2 3 4
5 6
Dobble Game -
Spot the
1 2 3 4
similarity 04
(unit? Test Case 6 3 4 5 6 7 8
unit=59&lesson=70) 9 10 11 12

What is your
date of birth? The due date for submitting this assignment has passed.
(unit? As per our records you have not submitted this assignment.
unit=59&lesson=71) Sample solutions (Provided by instructor)
Birthday 1 a,b=map(int,input().split())
2
Paradox - Find 3 count=1
your twin 01 4 m = []
(unit? 5 for i in range(1,a+1):
6 l = []
unit=59&lesson=72) 7 for j in range(1,b+1):
8 l.append(count)
Birthday 9 count+=1
Paradox - Find 10 m.append(l)
your twin 02
11
12 for i in range(a):
(unit? 13 for j in range(b):
unit=59&lesson=73) 14 if(j==b-1):
15 print(m[i][j], end="")
Birthday 16 else:
17 print(m[i][j], end=" ")
Paradox - Find 18 if(i!=a-1):
your twin 03 19 print()
(unit?
unit=59&lesson=74)

https://onlinecourses.nptel.ac.in/noc20_cs35/progassignment?name=282 2/4
02/07/2020 The Joy of Computing using Python - Course

Birthday
Paradox - Find
your twin 04
(unit?
unit=59&lesson=75)

Birthday
Paradox - Find
your twin 05
(unit?
unit=59&lesson=76)

What's your
favourite
movie? (unit?
unit=59&lesson=77)

Guess the
Movie Name
01 (unit?
unit=59&lesson=78)

Guess the
Movie Name
02 (unit?
unit=59&lesson=79)

Guess the
Movie Name
03 (unit?
unit=59&lesson=80)

Guess the
Movie Name
04 (unit?
unit=59&lesson=81)

Guess the
Movie Name
05 (unit?
unit=59&lesson=82)

Guess the
Movie Name
06 (unit?
unit=59&lesson=83)

Quiz :
Assignment 4
(assessment?
name=263)

Programming
Assignment-1:
Digits
(/noc20_cs35/progassignment?
name=280)

Programming
Assignment-2:
Factorial
(/noc20_cs35/progassignment?
name=281)

https://onlinecourses.nptel.ac.in/noc20_cs35/progassignment?name=282 3/4
02/07/2020 The Joy of Computing using Python - Course

Programming
Assignment-
3: Matrix
(/noc20_cs35/progassignment?
name=282)

Week 4
Feedback
(unit?
unit=59&lesson=283)

Week 5

Week 6

Week 7

Week 8

Week 9

Week 10

Week 11

Week 12

Text Transcripts

Download
Videos

Books

https://onlinecourses.nptel.ac.in/noc20_cs35/progassignment?name=282 4/4

You might also like