-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dhayanithi
committed
Oct 11, 2019
1 parent
e7db70b
commit 81bebea
Showing
9 changed files
with
119 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
print("hello world") | ||
#this will be printed 20 times | ||
print("_" * 20) | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#map | ||
|
||
a=[1,2,3,4] | ||
squared=list(map(lambda x:x*x,a)) | ||
print(squared) | ||
|
||
|
||
from functools import reduce | ||
#reduce | ||
sum = reduce((lambda x, y: x + y), a) | ||
print (sum) | ||
|
||
#filter | ||
|
||
filtered=list(filter(lambda x:x>2,a)) | ||
print(filtered) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import os | ||
import platform | ||
#waits for a keystroke without return statement | ||
def getch(): | ||
os.system("bash -c \"read -n 1\"") | ||
print('type any key') | ||
getch() | ||
|
||
#different code for different platforms | ||
|
||
def plat(): | ||
if(platform.system()=='Windows'): | ||
print('you are in windows') | ||
elif(platform.system()=='Linux'): | ||
print('you are in linux') | ||
|
||
plat() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from threading import Timer | ||
def prin(): | ||
print('i will print after 4sec') | ||
|
||
x=Timer(2.0,prin,args = None, kwargs = None) | ||
Timer.start(x) | ||
#to cancel a timer | ||
#Timer.cancel(x) | ||
|
||
|
||
|
||
|
||
|
This file contains 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
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
Q:What number does the Roman numeral "D" stand for? | ||
|
||
Answer:500 | ||
|
||
|
||
Q:Which anime heavily features music from the genre "Eurobeat"? | ||
|
||
Answer:Initial D | ||
|
||
|
||
Q:What is the name of the final boss in Turok: Dinosaur Hunter? | ||
|
||
Answer:The Campaigner | ||
|
||
|
||
Q:In "Shakugan no Shana" what was the Shana usually referred as? | ||
|
||
Answer:Flame-Haired Burning-Eyed Hunter | ||
|
||
|
||
Q:Which Italian automobile manufacturer gained majority control of U.S. automobile manufacturer Chrysler in 2011? | ||
|
||
Answer:Fiat | ||
|
||
|
||
Q:In the beta version of the 1986 game "The Legend of Zelda", players have the choice between a sword and what other item? | ||
|
||
Answer:Boomerang | ||
|
||
|
||
Q:What is the correct term for the metal object in between the CPU and the CPU fan within a computer system? | ||
|
||
Answer:Heat Sink | ||
|
||
|
||
Q:What breed of dog is "Scooby Doo"? | ||
|
||
Answer:Great Dane | ||
|
||
|
||
Q:In the game "Red Dead Redemption", what is the name of John Marston's dog? | ||
|
||
Answer:Rufus | ||
|
||
|
||
Q:What is the capital city of Slovenia? | ||
|
||
Answer:Ljubljana | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import requests | ||
|
||
def getquiz(): | ||
reqresponse=requests.get('https://opentdb.com/api.php?amount=10&type=multiple') | ||
reqdata=reqresponse.json()['results'] | ||
return reqdata | ||
|
||
def write(): | ||
data=getquiz() | ||
file=open('quiz.txt','w+') | ||
|
||
for question in data: | ||
q=question['question'] | ||
ans=question['correct_answer'] | ||
file.write('Q:{q} \n\n Answer:{ans}\n\n\n'.format(q=q,ans=ans)) | ||
file.close() | ||
write() | ||
|
||
|
||
|