@zareen said in CS606 Assignment 1 Solution and Discussion:
Use Subset Construction algorithm to find DFA for the NFA constructed in Task 1.
The resulting DFA is
Assignment No. 1
Semester: Fall 2019
CS441 – Big Data Concepts
Total Marks: 20
Due Date: 14/11/2019
Lectures covered:
Week 1 to week 3
Instructions
Please read the following instructions carefully before submitting assignment:
It should be clear that your assignment will not get any credit if:
o Assignment is submitted after due date.
o Submitted assignment does not open or file is corrupt.
o Assignment is copied (From internet/students).
Software allowed to develop Assignment
Objectives:
To enable the students to write and execute a program in Python. Moreover to familiarize students with the concepts of:
• Variables
• Operators
• Conditions
• Loop structures
Assignment Submission Instructions
You have to submit only.py file on the Assignments interface of CS441 on VULMS. Assignment submitted in any other format will not be accepted and will be graded zero marks.
Assignment
Write a program in Pyton programming language, which allows the user to input an integer value for a variable named upprtLimit. Based on the input value, the program should perform the following tasks:
• Find the even numbers within the given range (0 to upperLimit) and display all the even numbers on the screen.
• Find the odd numbers within the given range (0 to upperLimit) and display all the odd numbers on the screen.
• Calculate and display the sum of all even numbers within the given range (0 to upperLimit).
• Calculate and display the sum of all odd numbers within the given range (0 to upperLimit).
• Display the total number of even and odd numbers within the given range (0 to upperLimit).
For example, if a user enters upperLimit=20, then the sample output will be:
Sample output:
Deadline:
The deadline to submit your assignment solution is 14/11/2019. Your assignment must be submitted within the due date through VULMS. No assignment will be accepted through email after the due date.
start=0
evensum=0
oddsum=0
counteven=0
countodd=0
print("Enter the upper Limit:")
upperLimit=input()
print
print("Even numbers are:")
for num in range(start, upperLimit+1):
if num%2==0:
evensum=evensum+num
counteven=counteven+1
print(num)
print
print("Sum of Even numbers:")
print(evensum)
print
print("Total number of Even numbers within the range are:")
print(counteven)
print
print("Odd numbers are:")
for num1 in range(start, upperLimit+1):
if num1%2!=0:
oddsum=oddsum+num1;
countodd=countodd+1
print(num1)
print
print("Sum of Odd numbers:")
print(oddsum)
print
print("Total number of Odd numbers within the range are:")
print(countodd)
Recent Topics