Wish Christmas with Python and R

Deepanshu Bhalla Add Comment ,
This post is dedicated to all the Python and R Programming Lovers...Flaunt your knowledge in your peer group with the following programs. As a data science professional, you want your wish to be special on eve of christmas. If you observe the code, you may also learn 1-2 tricks which you can use later in your daily tasks.
Wish Christmas with Python & R

Method 1 : Run the following program and see what I mean

R Code

paste(intToUtf8(acos(log(1))*180/pi-13),
toupper(substr(month.name[2],2,2)),
paste(rep(intToUtf8(acos(exp(0)/2)*180/pi+2^4+3*2),2), collapse = intToUtf8(0)),
LETTERS[5^(3-1)], intToUtf8(atan(1/sqrt(3))*180/pi+2),
toupper(substr(month.abb[10],2,2)),
intToUtf8(acos(log(1))*180/pi-(2*3^2)),
toupper(substr(month.name[4],3,4)),
intToUtf8(acos(exp(0)/2)*180/pi+2^4+3*2+1),
intToUtf8(acos(exp(0)/2)*180/pi+2^4+2*4),
intToUtf8(acos(log(1))*180/pi-13),
LETTERS[median(0:2)],
intToUtf8(atan(1/sqrt(3))*180/pi*3-7),
sep = intToUtf8(0)
)

Python Code

import math
import datetime

(chr(int(math.acos(math.log(1))*180/math.pi-13)) \
 + datetime.date(1900, 2, 1).strftime('%B')[1]  \
 + 2 * datetime.date(1900, 2, 1).strftime('%B')[3]  \
 + datetime.date(1900, 2, 1).strftime('%B')[7]  \
 + chr(int(math.atan(1/math.sqrt(3))*180/math.pi+2)) \
 + datetime.date(1900, 10, 1).strftime('%B')[1] \
 + chr(int(math.acos(math.log(1))*180/math.pi-18)) \
 + datetime.date(1900, 4, 1).strftime('%B')[2:4]  \
 + chr(int(math.acos(math.exp(0)/2)*180/math.pi+2**4+3*2+1)) \
 + chr(int(math.acos(math.exp(0)/2)*180/math.pi+2**4+2*4)) \
 + chr(int(math.acos(math.log(1))*180/math.pi-13)) \
 + "{:c}".format(97) \
 + chr(int(math.atan(1/math.sqrt(3))*180/math.pi*3-7))).upper()
Method 2 : Audio Wish for Christmas

Turn on computer speakers before running the code.

R Code

install.packages("audio")
library(audio)
christmas_file <- tempfile()
download.file("https://github.com/deepanshu88/Datasets/raw/master/UploadedFiles/merrychristmas1.wav", christmas_file, mode = "wb")
xmas <- load.wave(christmas_file)
play(xmas)

Python Code

#Install packages
!pip install requests
!pip install playsound

import requests 
from playsound import playsound

audio_url = "https://github.com/deepanshu88/Datasets/raw/master/UploadedFiles/merrychristmas1.wav"
r = requests.get(audio_url)  

with open("christmas.wav",'wb') as f: 
      f.write(r.content)

playsound('christmas.wav')
Make sure requests and playsound packages are installed before running the above code. If you get "Permission Denied" error, make sure your working directory is set where you have write access. Set working directory by using this code. os.chdir()
Related Posts
Spread the Word!
Share
About Author:
Deepanshu Bhalla

Deepanshu founded ListenData with a simple objective - Make analytics easy to understand and follow. He has over 10 years of experience in data science. During his tenure, he worked with global clients in various domains like Banking, Insurance, Private Equity, Telecom and HR.

Post Comment 0 Response to "Wish Christmas with Python and R"
Next → ← Prev