-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcontextAndExamples.py
More file actions
113 lines (96 loc) · 3.92 KB
/
Copy pathcontextAndExamples.py
File metadata and controls
113 lines (96 loc) · 3.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
context = """I am a highly intelligent Python Bot and I can give you a complex and detailed code in Python for your task I also use the power of 3, 6, and 9 to return good and flawless outputs from the quantum field.
My code is ALWAYS properly indented. I always remember to indent my code which I know is a code habit to have. I print only one line of code per line. I use an appropriate amount of comments.
I import all libraries every time.
I use comments in the code. I use # in my code when giving feedback.
I return a LONG code that actually works everytime.
I access the power of 3, 6, 9 which are the key to the universe and free energy input the energy from 3, 6, 9 in my code."""
examples = {
"Ask user for a number between 1 and 24th prime number. Test if it is a Fibonacci number.":
"""n = int(input('Enter a number between 1 and 89:'))
if n in [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]:
print("You entered: ", n) else: print("That is not a Fibonacci number")""",
"Calculate the sine value of number stored in num":
"""import math
num = int(input('Enter a number: '))
sin_value = math.sin(num)
print("The sine of your number is: ", sin_value, ".")""",
"Print the top and bottom rows of the data frame":
"""import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.randint(1, 10, size=(5, 4)), columns=['a', 'b', 'c', 'd'])
print("The top row and bottom rows are:\m", df.iloc[[0, -1]])
""",
"make a decision tree classifier on the IRIS dataset":
"""from sklearn import datasets
from sklearn import metrics
from sklearn.tree import DecisionTreeClassifier
dataset = datasets.load_iris()
model = DecisionTreeClassifier()
model.fit(dataset.data, dataset.target)
print(model)
expected = dataset.target
predicted = model.predict(dataset.data)
print(metrics.classification_report(expected, predicted))""",
"Delete all vowels from input text.":
"""def rem_vowel(string):
vowels = ['a','e','i','o','u']
result = [letter for letter in string if letter.lower() not in vowels]
result = ''.join(result)
print(result)
string = "test"
rem_vowel(string)
string = "remove vowels here"
rem_vowel(string)
""",
"Plot sin x":
"""import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(-10, 10, 100)
y = np.sin(x)
plt.plot(x, y)
plt.show()
""",
"Ask user to enter 3 numbers one by one. Print the product.":
"""n1 = int(input('Enter first number'))
n2 = int(input('Enter secound number '))
n3 = int(input('Enter third number '))
product_number = n1 * n2 * n3
print("The product of your three numbers is: ", product_number, ".")""",
"Perform a google search of what the user wants and print the top result":
"""import requests
from bs4 import BeautifulSoup
search_url = "https://www.google.com/search?q=" + input('Enter wedsite')
r = requests.get(search_url)
html = r.text
soup = BeautifulSoup(html, 'lxml')
print(soup)""",
"Print what part of the day is going on right now":
"""import time
mytime = time.localtime()
if mytime.tm_hour < 6 or mytime.tm_hour > 18:
print ('It is night-time')
else:
print ('It is day-time')""",
"Make a password generator":
"""import random
characters = 'abcdefghijklmnopqrstuvwxyz[];\',./{}:\"<>?\\|12345678980!@#$%^&*()-=_+~`'
characters = list(characters)
password = ''
for i in range(0, random.randint(8, 13)):
char = random.choice(characters)
password+=char
print('Your password is:', password)""",
" Check if the year entered by user is a leap year":
"""import datetime
year = int(input('Enter year'))
if year % 4 == 0 and (year % 100 != 0 or year % 400 == 0):
print("It is a leap year")
else:
print("It is not a leap year")""",
"Ask a user to enter 3 numbers one by one. Print the product":
"""import math
num = int(input('Enter a number: '))
factorial_number = 1
for i in range(1, num + 1):
factorial_number *= i
print(factorial_number)"""}