NPTEL Course a fun filled whirlwind tour of 30 hrs, covering everything you need to know to fall in love with the most sought after skill of the 21st century. The course brings programming to your desk with anecdotes, analogies and illustrious examples. Turning abstractions to insights and engineering to art, the course focuses primarily to inspire the learner’s mind to think logically and arrive at a solution programmatically. As part of the course, you will be learning how to practice and culture the art of programming with Python as a language. At the end of the course, we introduce some of the current advances in computing to motivate the enthusiastic learner to pursue further directions. The Joy of Computing using python is a fun filled course offered by NPTEL.
The Joy Of Computing Using Python Week 4 Assignment 2023.
INTENDED AUDIENCE : Any interested audience
PREREQUISITES : 10th standard/high school
INDUSTRY SUPPORT : Every software company is aware of the potential of a first course in computer science. Especially of a first course in computing, done right.
Course Layout
- Motivation for Computing
- Welcome to Programming!!
- Variables and Expressions : Design your own calculator
- Loops and Conditionals : Hopscotch once again
- Lists, Tuples and Conditionals : Lets go on a trip
- Abstraction Everywhere : Apps in your phone
- Counting Candies : Crowd to the rescue
- Birthday Paradox : Find your twin
- Google Translate : Speak in any Language
- Currency Converter : Count your foreign trip expenses
- Monte Hall : 3 doors and a twist
- Sorting : Arrange the books
- Searching : Find in seconds
- Substitution Cipher : What’s the secret !!
- Sentiment Analysis : Analyse your Facebook data
- 20 questions game : I can read your mind
- Permutations : Jumbled Words
- Spot the similarities : Dobble game
- Count the words : Hundreds, Thousands or Millions.
- Rock, Paper and Scissor : Cheating not allowed !!
- Lie detector : No lies, only TRUTH
- Calculation of the Area : Don’t measure.
- Six degrees of separation : Meet your favourites
- Image Processing : Fun with images
- Tic tac toe : Let’s play
- Snakes and Ladders : Down the memory lane.
- Recursion : Tower of Hanoi
- Page Rank : How Google Works !!
Programming Assignment 1
Question 1 : Write a program that takes a number `n` as input and prints the sum of the squares of the first `n` positive integers.
Example:
If n = 4, the program should output 30 (1^2 + 2^2 + 3^2 + 4^2 = 30)
n=int(input())
val=0
for i in range(1,n+1):
val+=i**2
print(val,end="")
Programming Assignment 2
Question 2 : Write a program that takes a number `n` as input and prints the nth power of 2.
If n = 4, the program should output 16 (2^4 = 16)
n=int(input())
print(2**n,end="")
Programming Assignment 3
Question 3 : Write a program that takes a number `n` as input and prints a pyramid of numbers with `n` rows.
If n = 5, the program should output the following
232
34543
4567654
567898765
n = int(input())
m_row = 1
n_row = 1
for row in range(1, n+1):
b = 0
for space in range(1, n-row+1):
print(" ", end="")
a = row
left = []
while(a != n_row):
if a > 9:
left.append(str(b))
b += 1
else:
left.append(str(a))
a += 1
if row == n:
print("".join(left) + str(m_row) + "".join(left[::-1]), end="")
else:
print("".join(left) + str(m_row) + "".join(left[::-1]))
if (m_row+2 > 9):
m_row = -1
m_row += 2
n_row += 2