0% found this document useful (0 votes)
4 views

Abhishek{Python} (1)[1]

The document outlines an experiment for a Python programming course where students create a program that generates either a multiplication table or a number pattern based on user input. It includes the aim, procedure, code implementation, and sample output for both functionalities. The experiment is designed for a student named Abhishek in the 3rd semester of the Computer Science and Engineering department.

Uploaded by

at0389164
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Abhishek{Python} (1)[1]

The document outlines an experiment for a Python programming course where students create a program that generates either a multiplication table or a number pattern based on user input. It includes the aim, procedure, code implementation, and sample output for both functionalities. The experiment is designed for a student named Abhishek in the 3rd semester of the Computer Science and Engineering department.

Uploaded by

at0389164
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

Experiment1.1
Student Name: Abhishek UID: 23BCS12996
Branch: CSE Section/Group:801-B
Semester:3rd Date of Performance:1/08
Subject Name: Python programing Subject Code:23CSP-201

1. Aim: Write a code to create a versatile program that generates


either multiplication table or a number pattern based on user
choice

2. Requirements(Hardware/Software):

3.Procedure: Procedure for the Code


Display Menu Options:

Show the user a menu with three options:


1: Generate a multiplication table.
2: Generate a number pattern.
3: Exit the program.
Get User Input:

Capture the user's choice from the menu options.


Depending on the user's choice, execute the corresponding
functionality.
Handle Each Option:

Option 1: Multiplication Table

Prompt the user to enter a number for which they want the
multiplication table.
Generate and print the multiplication table for that number from 1
to 10.
Option 2: Number Pattern
Prompt the user to enter the number of rows for the number
pattern.
Generate and print a pattern where each row contains numbers
from 1 up to the row number.
Option 3: Exit

4. Code:

x=int(input("choose a option : 1.multiplication table ||


2.generating a number pattern || 3.exit "))
#we gave the user option to choose between 1 || 2 || 3

#now we will create the code for multiplication table


if x==1:
#you can use give your number
num=int(input("choose the number for multiplication table :"))
for i in range(1, 11):
print(num, '*', i, '=', num*i)

elif x==2:
rows= int(input("Please enter how many rows you need: "))
for i in range(1, rows+1):
for j in range(1, i + 1):
print(j, end=' ')
print('')

else:
print("You are Done")

5. Output:

choose a option : 1.multiplication table || 2.generating a


number pattern || 3.exit
1
choose the number for multiplication table :4
4*1=4
4*2=8
4 * 3 = 12
4 * 4 = 16
4 * 5 = 20
4 * 6 = 24
4 * 7 = 28
4 * 8 = 32
4 * 9 = 36
4 * 10 = 40

2
Please enter how many rows you need: 3
1
12
123

3
You are Done

6. Learning Outcome:

You might also like