This is a quick guide to Kotlin programming language. The previous part of this guide is here
fun main(args : Array<String>) {
class local (val x : Int)
val y = local(10)
println("${y.x}")| def transposeMatrix(m): | |
| return map(list,zip(*m)) | |
| def getMatrixMinor(m,i,j): | |
| return [row[:j] + row[j+1:] for row in (m[:i]+m[i+1:])] | |
| def getMatrixDeternminant(m): | |
| #base case for 2x2 matrix | |
| if len(m) == 2: | |
| return m[0][0]*m[1][1]-m[0][1]*m[1][0] |
| package org.yaswant.test; | |
| import org.cloudbus.cloudsim.*; | |
| import org.cloudbus.cloudsim.core.CloudSim; | |
| import org.cloudbus.cloudsim.provisioners.BwProvisionerSimple; | |
| import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple; | |
| import org.cloudbus.cloudsim.provisioners.RamProvisionerSimple; | |
| import org.workflowsim.*; | |
| import org.workflowsim.failure.FailureGenerator; | |
| import org.workflowsim.failure.FailureMonitor; |
| import os | |
| file = open('courselinks.txt', 'r') | |
| temp = [link.replace('/table-of-contents', '') for link in file] | |
| urls = [link.replace('\n', '') for link in temp] | |
| default_path = os.getcwd() | |
| for url in urls : | |
| download_folder = default_path + '/' + url[44:] |
This is a quick guide to Kotlin programming language. The previous part of this guide is here
fun main(args : Array<String>) {
class local (val x : Int)
val y = local(10)
println("${y.x}")Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3
Kotlin project website is at kotlin.jetbrains.org.
All the codes here can be copied and run on Kotlin online editor.
Let's get started.
| for song_name in list_of_songs: | |
| song_name = formatting(song_name) | |
| response = requests.get('https://www.youtube.com/results?', params={'search_query': song_name}) | |
| content = BeautifulSoup(response.content) | |
| proper_video = scraper(content) | |
| if not proper_video: | |
| songs_not_downloaded.append(song_name) | |
| continue | |
| entire_link = "https://www.youtube.com{}".format(proper_video['link']) | |
| # print(entire_link) |