Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assignment 1 and 2 #12

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions 220889_Rishav Raj/Assignment_1/first.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#Write the code to get your rollno and name using arguments
def fun(rollno,name):
print(rollno, name)
fun(rollno="220889 ",name="RISHAV RAJ")

#Give an example of calling a function
def calling(a,b):
print("First Name= ",a," Last Name= ",b)
calling(a="Rishav",b="Raj")

#Write a python code to calculate the sum of first 10 integers using loop
sum=0
for c in range(0,10):
sum+=c
print(sum)


39 changes: 39 additions & 0 deletions 220889_Rishav Raj/Assignment_2/ppoc assignment 2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import matplotlib.pyplot as plt
features = ['A', 'B', 'C']
values = [2, 3, 4]
colors = ['red', 'blue', 'green']
plt.bar(features, values, color=colors)
plt.title('Bar Graph')
plt.xlabel('Variables')
plt.ylabel('Values')
plt.show()

import matplotlib.pyplot as plt
features = ['A', 'B', 'C', 'D']
values = [10, 20, 15, 5]
plt.bar(features, values)
plt.title('Example Bar Graph')
plt.xlabel('Variables')
plt.ylabel('Values')
plt.show()

import matplotlib.pyplot as plt
x_values = [1, 2, 3, 4, 5]
y_values = [2, 3, 5, 8, 9]
plt.scatter(x_values, y_values, color='red')
for i in range(len(x_values)-1):
plt.plot([x_values[i], x_values[i+1]], [y_values[i], y_values[i+1]], color='blue')
plt.title('Scattered Points with Lines')
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.show()

import numpy as np
arr = np.array([1, 2, 5, 3])
addition = arr + 2
subtraction = arr - 1
multiplication = arr * 3
print('Original array:', arr)
print('Array after addition:', addition)
print('Array after subtraction:', subtraction)
print('Array after multiplication:', multiplication)