From e7db70bd1bb9f1730ca80b40c84ffddaa80da959 Mon Sep 17 00:00:00 2001 From: Dhayanithi Date: Thu, 10 Oct 2019 18:44:42 -0700 Subject: [PATCH] all --- 19.osmodule.py | 5 +++++ index.html | 0 projects/apirequests.py | 6 ++++-- projects/binarysearchtree.py | 1 - 4 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 19.osmodule.py delete mode 100644 index.html diff --git a/19.osmodule.py b/19.osmodule.py new file mode 100644 index 0000000..7d617a2 --- /dev/null +++ b/19.osmodule.py @@ -0,0 +1,5 @@ +import os + +print(os.name) + +print(os.getcwd()) \ No newline at end of file diff --git a/index.html b/index.html deleted file mode 100644 index e69de29..0000000 diff --git a/projects/apirequests.py b/projects/apirequests.py index 2a94005..48b0101 100644 --- a/projects/apirequests.py +++ b/projects/apirequests.py @@ -1,5 +1,6 @@ import requests import random +import os url='https://opentdb.com/api.php?amount=10&type=multiple' originaldata={} @@ -15,6 +16,7 @@ def getUsers(url): originaldata=getUsers(url) def ask(data,choicearray): + for index in range(len(data)): q=''' Question.no:{qno}\n @@ -50,7 +52,7 @@ def ask(data,choicearray): if four==correct_answer: correctchoice=4 choicearray.append(correctchoice) - + os.system('cls') print(q.format(qno=index+1,question=data[index]['question'],category=data[index]['category'],one=one,two=two,three=three,four=four)) answer=int(input(' ')) @@ -65,4 +67,4 @@ def ask(data,choicearray): if(choicearray[num]==userchoice[num]): userscore+=1 -print('userscore is {score}'.format(score=userscore)) \ No newline at end of file +print('You have answered {score} questions correctly'.format(score=userscore)) \ No newline at end of file diff --git a/projects/binarysearchtree.py b/projects/binarysearchtree.py index 01a75b0..cd7f53b 100644 --- a/projects/binarysearchtree.py +++ b/projects/binarysearchtree.py @@ -1,5 +1,4 @@ numbers=[] - def createnumlist(array): for num in range(0,101): if num%2==0: