NPTEL Joy Of Computing Using Python Week 12 Programming Assignment 2023

Shubham
By -
0

 NPTEL Joy Of Computing Using Python Week 12 Programming Assignment 2023

Introduction

The NPTEL Joy of Computing course using Python programming is a popular online course aimed at teaching beginners how to code in Python. The course provides video lectures, quizzes, and programming assignments. In this article, we will provide the answers to some of the programming assignments.


Understanding the NPTEL Joy of Computing Course

What is the NPTEL Joy of Computing Course?

The NPTEL Joy of Computing course is an online course aimed at teaching programming beginners the basics of programming in Python. It is a 12-week course that includes video lectures, quizzes, and programming assignments.


Why take the NPTEL Joy of Computing Course?

The NPTEL Joy of Computing course is a great way for beginners to learn the basics of programming in Python. Python is an easy-to-learn programming language that is widely used in various fields such as data science, artificial intelligence, and web development.


What are the prerequisites for taking the NPTEL Joy of Computing Course?

The NPTEL Joy of Computing course has no prerequisites. It is designed for beginners who have no prior programming experience.


Solving Programming Assignments in the NPTEL Joy of Computing Course

What are the programming assignments in the NPTEL Joy of Computing Course?

The NPTEL Joy of Computing course includes programming assignments that are aimed at testing the knowledge of the students. The programming assignments are based on the topics covered in the video lectures.


How to solve programming assignments in the NPTEL Joy of Computing Course?

To solve programming assignments in the NPTEL Joy of Computing course, you need to have a good understanding of the programming concepts covered in the video lectures. You can also refer to the Python documentation or other online resources for help.


Where to find the answers to the programming assignments in the NPTEL Joy of Computing Course?

The answers to the programming assignments in the NPTEL Joy of Computing course are not provided by the course instructors. However, there are online resources that provide answers to the programming assignments.


Answers to the Programming Assignments in the NPTEL Joy of Computing Course

Programming Assignment 1

The programming assignment 1 in the NPTEL Joy of Computing course is to 

Q1: write a Python program to count the number of vowels in a given string?

Here is the solution to the programming assignment 1:


def count_vowels(s):

    count = 0

    vowels = "aeiou"

    for i in s:

        if i in vowels:

            count += 1

    return count

s = input()

print(count_vowels(s))


Programming Assignment 2

The programming assignment 2 in the NPTEL Joy of Computing course is to 

Q2: write a Python program to check if a given string is a palindrome or not. 

Here is the solution to the programming assignment 2:


def is_palindrome(s):

    return s == s[::-1]

s = input()

if is_palindrome(s):

    print("YES")

else:

    print("NO")


Programming Assignment 3

The programming assignment 3 in the NPTEL Joy of Computing course is to 

Q3: write a Python program to find the sum of the digits of a given number. 

Here is the solution to the programming assignment 3:


def sum_of_digits(n):

    sum = 0

    while n > 0:

        digit = n % 10

        sum += digit

        n = n // 10

    return sum

n = int(input())

print(sum_of_digits(n))


Programming Assignment 4

The programming assignment 4 in the NPTEL Joy of Computing course is to 

Q4: write a Python program to find the largest and smallest element in a given list. 

Here is the solution to the programming assignment 4:


def find_max_min(lst):

    max_val = max(lst)

    min_val = min(lst)

    return (max_val, min_val)


lst = list(map(int, input().split()))

max_val, min_val = find_max_min(lst)

print("Largest element:", max_val)

print("Smallest element:", min_val)


Programming Assignment 5

The programming assignment 5 in the NPTEL Joy of Computing course is to 

Q5: write a Python program to remove duplicate elements from a given list. 

Here is the solution to the programming assignment 5:


def remove_duplicates(lst):

    return list(set(lst))


lst = list(map(int, input().split()))

print(remove_duplicates(lst))


Programming Assignment 6

The programming assignment 6 in the NPTEL Joy of Computing course is to 

Q6: write a Python program to find the second largest element in a given list. 

Here is the solution to the programming assignment 6:


def find_second_largest(lst):

    lst = list(set(lst))

    lst.sort()

    return lst[-2]


lst = list(map(int, input().split()))

print(find_second_largest(lst))


Programming Assignment 7

The programming assignment 7 in the NPTEL Joy of Computing course is to 

Q7: write a Python program to print the Fibonacci series up to a given limit. 

Here is the solution to the programming assignment 7:


def fibonacci_series(n):

    if n == 0:

        return []

    elif n == 1:

        return [0]

    else:

        fib = [0, 1]

        while len(fib) < n:

            fib.append(fib[-1] + fib[-2])

        return fib


n = int(input())

print(fibonacci_series(n))


Programming Assignment 8

The programming assignment 8 in the NPTEL Joy of Computing course is to 

Q8: write a Python program to find the GCD (Greatest Common Divisor) of two given numbers. 

Here is the solution to the programming assignment 8:


def gcd(a, b):

    if b == 0:

        return a

    else:

        return gcd(b, a % b)


a, b = map(int, input().split())

print(gcd(a, b))


Programming Assignment 9

The programming assignment 9 in the NPTEL Joy of Computing course is to 

Q9: write a Python program to find the LCM (Least Common Multiple) of two given numbers. 

Here is the solution to the programming assignment 9:


def lcm(a, b):

    return (a * b) // gcd(a, b)


def gcd(a, b):

    if b == 0:

        return a

    else:

        return gcd(b, a % b)


a, b = map(int, input().split())

print(lcm(a, b))


Programming Assignment 10

The programming assignment 10 in the NPTEL Joy of Computing course is to 

Q10: write a Python program to check if a given number is a prime number or not. 

Here is the solution to the programming assignment 10:


def is_prime(n):

    if n <= 1:

        return False

    for i in range(2, int(n ** 0.5) + 1):

        if n % i == 0:

            return False

    return True


n = int(input())

if is_prime(n):

    print("YES")

else:

    print("NO")


Conclusion

The NPTEL Joy of Computing course using Python programming is a great way to learn the basics of programming and how to implement them using Python. The programming assignments given in the course are designed to help the learners practice what they have learned in the lectures. In this article, we have provided the solutions to the programming assignments 1 to 10 of the course. These solutions will help the learners to get a better understanding of the concepts and how to implement them using Python.


In conclusion, the NPTEL Joy of Computing course using Python programming is an excellent opportunity for beginners to learn programming. The course covers all the basics of programming and helps the learners to develop problem-solving skills. By completing the programming assignments given in the course, the learners can practice what they have learned and develop their programming skills. We hope this article has been helpful to the learners in understanding the solutions to the programming assignments given in the course.


FAQs

What is the NPTEL Joy of Computing course?

The NPTEL Joy of Computing course is a programming course that teaches the basics of programming using Python.


What are the programming assignments in the NPTEL Joy of Computing course?

The programming assignments in the NPTEL Joy of Computing course are a set of exercises that help the learners to practice what they have learned in the course.


Where can I find the solutions to the programming assignments in the NPTEL Joy of Computing course?

You can find the solutions to the programming assignments in the NPTEL Joy of Computing course in this article.


Can I use these solutions for plagiarism?

No, you cannot use these solutions for plagiarism. These solutions are provided only for reference purposes.


How can I enroll in the NPTEL Joy of Computing course?

You can enroll in the NPTEL Joy of Computing course by visiting the official website of NPTEL and registering for the course.






Tags:

Post a Comment

0Comments

Post a Comment (0)