0% found this document useful (0 votes)
5 views2 pages

Python Assignment

The document is a Python assignment by Gurkirat Singh discussing the history and evolution of Python, highlighting its founding by Guido van Rossum in 1989 and subsequent versions. It outlines Python's user-friendly characteristics, including its readability, dynamic typing, and extensive libraries, making it popular in various fields. Additionally, the assignment includes code examples for an if/else statement and a password validation program.

Uploaded by

singhkirat4224
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Python Assignment

The document is a Python assignment by Gurkirat Singh discussing the history and evolution of Python, highlighting its founding by Guido van Rossum in 1989 and subsequent versions. It outlines Python's user-friendly characteristics, including its readability, dynamic typing, and extensive libraries, making it popular in various fields. Additionally, the assignment includes code examples for an if/else statement and a password validation program.

Uploaded by

singhkirat4224
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Name: Gurkirat Singh

Sap ID: 590012199


Batch: 56

Python Assignment 1

Q1. Discuss the history and evolution of Python?


Ans. Guido van Rossum, the founding father of Python in 1989, was influenced by the ABC
language, with the idea of keeping it simple and readable. The first-ever release, Python 1.0,
surfaced in 1991 and with it came features such as modules, functions, and core data types.
Python 2.x in 2000 incorporated many improvements including garbage collection, but did not
maintain backwards compatibility. In 2008, with the advent of Python 3.x, the issues of
backwards compatibility were fixed, as the new version focused on unicode support and a
cleaner syntax. Today, Python is becoming quite the favorite in web development, data science,
and AI, among many others, courtesy of its simplicity and large community of supporters.

Q2. Enlist the characteristics of Python and explain why it is considered user-friendly.
Ans. Python is a high-level, interpreted language with a syntax that is easier to read, thereby
friendly to beginners. It has dynamic typing, automatic memory management, and a large
standard library, all resulting in shorter development time. It is cross-platform and has
frameworks for web development (Django), data analysis (Pandas), and more, making it
versatile and widely used.

Q3. Write an if/else statement with the following condition: If the variable age is greater than 18,
output "Old enough", otherwise output "Too young".
Ans.
age = 20
if age > 18:
print("Old enough")
else:
print("Too young")
Q4. Write a program that
a) Store correct password in a variable.
b) Asks user to enter his/her password
c) Validate the two passwords: i. Check if user has entered password. If not, then give message
“Please enter your password” ii. Check if both passwords are same. If they are same, show
message “Correct! The password you entered matches the original password”. iii. Show
“Incorrect password” otherwise.
Ans.

# a) Store the correct password


correct_password = "Python@123"
# b) Ask the user for their password
user_password = input("Enter your password: ")
# c) Validate the passwords
if not user_password:
print("Please enter your password")
elif user_password == correct_password:
print("Correct! The password you entered matches the original password.")
else:
print("Incorrect password")

You might also like