Skip to content

Instantly share code, notes, and snippets.

View Sachin-crypto's full-sized avatar

Sachin Pal Sachin-crypto

View GitHub Profile
# A Simple Calculator
# Taking Input from User
print("Enter the 1st value: ")
user_input1 = input()
print("Enter the 2nd value: ")
user_input2 = input()
print("Enter the operator: '+', '-', '*', '/', '**', '//', '%', 'percentage': ")
user_input3 = input()
with open("first.txt") as file_1, open("second.txt") as file_2, open("third.txt") as file_3:
f1 = file_1.read()
f2 = file_2.read()
f3 = file_3.read()
for lines in f1, f2, f3:
print(lines)
import fileinput
with fileinput.input(files=('first.txt', 'second.txt','third.txt')) as f:
for line in f:
print(line)
# Importing neccessary libraries
import streamlit as st
import pandas as pd
import plotly.express as px
st.title("Covid-19 EDA and Visualization")
st.markdown('''
A Web App to visualize and analyze the Covid-19 data from India
* **Libraries Used:** Streamlit, Pandas, Plotly
# Importing numpy as np
import numpy as np
# Creating 2D array with random integers
input_arr = np.random.randint(16, size=(4, 4))
print("INPUT ARRAY: \n", input_arr)
# Printing the indices of the max element along the axis 0
print("\nIndices of MAX ELEMENT", np.argmax(input_arr, axis=0))
# Importing tensorflow as tf
import tensorflow as tf
# Tensor to work on
inp_tensor = tf.constant([3, 1, 5, 10, 45, 21])
# Applying argmax
out = tf.argmax(inp_tensor)
# Printing the index of the highest value
# Importing tensorflow as tf
import tensorflow as tf
# Tensor to work on
inp_tensor = tf.constant([[7, 13, 9, 10, 13.5, 21], [9, 2, 8, 14, 45, 21], [92, 3, 14, 92.1, 19, 8]])
# Printing the indices of the highest values along axis 0
print(f"INDEX of highest value: {tf.argmax(inp_tensor, 0)}")
print("Tensor:", tf.argmax(inp_tensor, 0), "\n")
# Importing numpy as np
import numpy as np
# Creating a 2D array of shape 3, 6
arr = np.arange(18).reshape(3, 6)
# Printing out an input array
print("INPUT ARRAY: \n", arr)
# Applying argmax to the input array
# Importing Numpy
import numpy as np
# Working with 1D array
inp_arr = np.array([5, 2, 9, 4, 2])
# Applying argmax() function
max_elem_index = np.argmax(inp_arr)
# Printing index
# Importing Numpy
import numpy as np
# Creating 2D array
arr = np.random.randint(16, size=(4, 4))
# Array preview
print("INPUT ARRAY: \n", arr)
# Applying argmax()