0% found this document useful (0 votes)
48 views5 pages

Activity 4 Introduction To Python Programming

The document describes an activity on basic Python programming concepts for a course. It includes 11 questions to write Python code to perform tasks like taking user input, doing calculations, conditional checking, and type conversions. Example code and outputs are provided for each question to help students learn concepts like variables, data types, user input/output, if-else conditions, arithmetic operations etc. It concludes with some additional practice questions for students.

Uploaded by

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

Activity 4 Introduction To Python Programming

The document describes an activity on basic Python programming concepts for a course. It includes 11 questions to write Python code to perform tasks like taking user input, doing calculations, conditional checking, and type conversions. Example code and outputs are provided for each question to help students learn concepts like variables, data types, user input/output, if-else conditions, arithmetic operations etc. It concludes with some additional practice questions for students.

Uploaded by

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

CSE100 Fundamentals of Computer Programming

Activity 4: Introduction to Python Programming


Topics covered in the activity:
 Basics of Python Programming – Understanding Python environment, Basic Syntax,
Comments, Flowchart to Python program conversion, Data types, input/output
operations, use of variables, numbers and strings
 Software to be used: Python’s IDLE

Roll No. AU2140213 Name: Vanaja Binay Agarwal Section No.: 2

1. Write a Python program to read and print your name (Concept to learn: Getting familiar with
Python IDE, User input and output).
Code:
print("Hello")
Sample Output:
Hello
2. Write a Python program to read and print your name and address using the input() function.
Code:

name = input("Enter name: ")


print("The entered name is: ", name)

Sample Output:

Enter name: Vanaja


The entered name is: Vanaja

3. Write a Python program to print content of your ID – Card (Concept to learn: Formatted output).
Roll No : AU****101
NAME : KUNTAL PATEL
ADDRESS : Ahmedabad
SEAS
Ahmedabad University
Code:
rollno = input("Enter your Auris Roll number: ")
name= input("Enter name: ")
addr = input("Enter Address: ")
print("Roll No :",rollno)
print("NAME :",name)
print("ADDRESS :",addr)
print("SEAS")
print("Ahmedabad University")

Sample Output:
Enter your Auris Roll number: AU2140213
Enter name: VANAJA AGARWAL
Enter Address: AHMEDABAD
Roll No : AU2140213
NAME : VANAJA AGARWAL
ADDRESS : AHMEDABAD
SEAS
Ahmedabad University

4. Write a Python Program to get an integer input from user and display it.
Code:
no = int(input("Enter number(integer): "))
print("The entered number is: ",no)

Sample Output:
Enter number(integer): 67
The entered number is: 67
5. Write a Python program to add two given numbers.
Code:
no1 = int(input("Enter number 1: "))
no2 = int(input("Enter number 2: "))
total = no1 + no2
print("The sum of the two entered integers is :", total)

Sample Output:
Enter number 1: 23
Enter number 2: 45
The sum of the two entered integers is : 68

6. Accept two numbers from user and display average of given numbers.
Code :
no1 = int(input("Enter number 1: "))
no2 = int(input("Enter number 2: "))
avg = (no1 + no2)/2
print("The average of the two entered numbers is :", avg)

Sample Output:
Enter number 1: 12
Enter number 2: 65
The average of the two entered numbers is : 38.5

7. Write a Python Program to read percentage of user and display it.


Code:
per = input("Enter percentage: ")
print("The entered percentage is: ",per)

Sample Output:
Enter percentage: 99.9
The entered percentage is: 99.9

8. Write a Python program to input a number and check whether the entered number is positive or
not.
Code:
no = int(input("Enter a number :"))
if no>=0:
print("The entered number is a positive integer")
else:
print("The entered number is a negative integer")

Sample Output:
Enter a number :-4
The entered number is a negative integer

9. Write a Python program to display Good Morning message based in given time.
Code:
time = int(input("Enter time(24 hrs): "))
if time>=0 and time<12:
print("Good Morning!")
else:
print("Good Afternoon!")

Sample Output:
Enter time(24 hrs): 2
Good Morning!

10. Write a Python program to check whether a number is divisible by 5 or not.

Code:
no = int(input("Enter a number :"))
if (no%5)==0:
print("The entered number is divisible by 5")
else:
print("The entered number is not divisible by 5")
Sample Output:
Enter a number :35
The entered number is divisible by 5
11. Write a Python program to Convert Celsius To Fahrenheit.
Code:
celsius = float(input("Enter temperature in celsius: "))
fahrenheit = (celsius * 1.8) + 32
print(celsius," degrees C in Fahrenheit is", fahrenheit,"F")

Sample Output:
Enter temperature in celsius: 25
25.0 degrees C in Fahrenheit is 77.0 F

Practice Questions
Note: The below questions are for practice and NOT required to be submitted as
part of activity submission.

1. Write a python program to check whether a person is eligible to vote or not.

2. Write a python program to convert Kilometers to Miles.

3. Write a python program input 3 numbers from user and print the maximum among them.

4. Write a python program to read marks of 3 subjects (out of 100). Calculate and print the

percentage.

5. Write a python program to find area of rectangle.

You might also like