This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
# Initializing a variable with positive infinity | |
positive_inf = math.inf | |
print('Positive Infinity: ', positive_inf) | |
# Initializing a variable with negative infinity | |
negative_inf = -math.inf | |
print('Negative Infinity: ', negative_inf) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Initializing a variable with positive infinity | |
positive_inf = float('inf') | |
print('Positive Infinity: ', positive_inf) | |
# Initializing a variable with negative infinity | |
negative_inf = float('-inf') | |
print('Negative Infinity: ', negative_inf) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%html | |
<html> | |
<body> | |
<h3>Student Marks</h3> | |
<table> | |
<tr> | |
<th>Name</th> | |
<th>Roll</th> | |
<th>Age</th> | |
<th>Marks</th> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
roll_number = 12 | |
name = 'Chaitanya Baweja' | |
age = 14 | |
%who | |
# Output | |
# age name roll_number |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%writefile -a my_file.py | |
# Function to return diff of two numbers | |
def diff_num(a,b): | |
return a-b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%writefile my_file.py | |
# Function to return sum of two numbers | |
def sum_num(a,b): | |
return a+b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hello(): | |
print('Hello Chaitanya') | |
hello() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Importing required libraries | |
import urllib.request | |
# Adding information about user agent | |
opener=urllib.request.build_opener() | |
opener.addheaders=[('User-Agent','Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1941.0 Safari/537.36')] | |
urllib.request.install_opener(opener) | |
# setting filename and image URL | |
filename = 'sunshine_dog.jpg' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# importing required modules | |
import urllib.request | |
# setting filename and image URL | |
filename = 'sunshine_dog.jpg' | |
image_url = "https://cdn.pixabay.com/photo/2020/02/06/09/39/summer-4823612_960_720.jpg" | |
# calling urlretrieve function to get resource | |
urllib.request.urlretrieve(image_url, filename) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First import wget python module. | |
import wget | |
# Set up the image URL | |
image_url = "https://cdn.pixabay.com/photo/2020/02/06/09/39/summer-4823612_960_720.jpg" | |
# Use wget download method to download specified image url. | |
image_filename = wget.download(image_url) | |
print('Image Successfully Downloaded: ', image_filename) |