├── 2day.py ├── 4day.py ├── 3day.py ├── 1day.py ├── Screenshot from 2025-05-20 23-40-44.png ├── 6day.py ├── 5day.py ├── 7day.py ├── index.html ├── json save data.py ├── sever.js └── app.py /2day.py: -------------------------------------------------------------------------------- 1 | # verelave learning 2 | name = "Nahid HK" 3 | myname = " data load function!" 4 | print(myname) 5 | print (name) -------------------------------------------------------------------------------- /4day.py: -------------------------------------------------------------------------------- 1 | # 2nd veryavle 2 | YourName = "Nahid" 3 | MyName = "Hossen" 4 | print("My Name Is " + ' ' + YourName + "_" + MyName) -------------------------------------------------------------------------------- /3day.py: -------------------------------------------------------------------------------- 1 | # data type py 2 | 3 | nahid = 2229 4 | dayg = 192929j 5 | 6 | print(type(dayg)) 7 | print(nahid) 8 | print(type(nahid)) -------------------------------------------------------------------------------- /1day.py: -------------------------------------------------------------------------------- 1 | print("hello Python") 2 | print("hello world") 3 | print(101) 4 | print("10183") 5 | # the comments 6 | '''Hello comments''' 7 | -------------------------------------------------------------------------------- /Screenshot from 2025-05-20 23-40-44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nahidhk/PythonLabTest/HEAD/Screenshot from 2025-05-20 23-40-44.png -------------------------------------------------------------------------------- /6day.py: -------------------------------------------------------------------------------- 1 | num1 = 10 2 | num2 = 30 3 | num3 = num1 + num2 4 | Username = "nahidhk" 5 | print(f"This is My number {Username} my roll is {num3}") 6 | -------------------------------------------------------------------------------- /5day.py: -------------------------------------------------------------------------------- 1 | # bool data type 2 | Bool = True 3 | nahid = False 4 | print(Bool) 5 | print(type(Bool)) 6 | print(nahid) 7 | x = 8 8 | y = 10 9 | print (x>y) 10 | print (x 2 | 3 | 4 | 5 | 6 | Form 7 | 8 | 9 |
10 | 11 | 12 | 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /json save data.py: -------------------------------------------------------------------------------- 1 | # from http.server import BaseHTTPRequestHandler, HTTPServer 2 | # import json 3 | 4 | # class RequestHandler(BaseHTTPRequestHandler): 5 | # def _set_headers(self, status=200): 6 | # self.send_response(status) 7 | # self.send_header('Content-type', 'text/plain') 8 | # self.end_headers() 9 | 10 | # def do_POST(self): 11 | # content_length = int(self.headers['Content-Length']) 12 | # post_data = self.rfile.read(content_length) 13 | # data = json.loads(post_data) 14 | 15 | # with open('data.json', 'w') as f: 16 | # json.dump(data, f) 17 | 18 | # self._set_headers() 19 | # self.wfile.write("Data saved successfully".encode('utf-8')) 20 | 21 | # def run(server_class=HTTPServer, handler_class=RequestHandler, port=3000): 22 | # server_address = ('', port) 23 | # httpd = server_class(server_address, handler_class) 24 | # print(f'Server is running on port {port}') 25 | # httpd.serve_forever() 26 | 27 | # if __name__ == '__main__': 28 | # run() 29 | -------------------------------------------------------------------------------- /sever.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const http = require('http'); 3 | const qs = require('querystring'); 4 | 5 | const server = http.createServer((req, res) => { 6 | if (req.method === 'POST') { 7 | let body = ''; 8 | req.on('data', chunk => { 9 | body += chunk.toString(); 10 | }); 11 | req.on('end', () => { 12 | const formData = qs.parse(body); 13 | const jsonData = JSON.stringify(formData); 14 | 15 | fs.writeFile('data.json', jsonData, 'utf8', (err) => { 16 | if (err) { 17 | console.error(err); 18 | res.writeHead(500, {'Content-Type': 'text/plain'}); 19 | res.end('Internal Server Error'); 20 | return; 21 | } 22 | console.log('Data saved successfully'); 23 | res.writeHead(200, {'Content-Type': 'text/plain'}); 24 | res.end('Data saved successfully'); 25 | }); 26 | }); 27 | } else { 28 | res.writeHead(405, {'Content-Type': 'text/plain'}); 29 | res.end('Method Not Allowed'); 30 | } 31 | }); 32 | 33 | const PORT = process.env.PORT || 3000; 34 | server.listen(PORT, () => { 35 | console.log(`Server is running on port ${PORT}`); 36 | }); 37 | -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, request, render_template_string 2 | 3 | app = Flask(__name__) 4 | 5 | @app.route('/', methods=['GET', 'POST']) 6 | def index(): 7 | if request.method == 'POST': 8 | file_name = request.form.get('file_name') 9 | data = request.form.get('data') 10 | 11 | if file_name and data: 12 | with open(file_name, 'w') as file: 13 | file.write(data) 14 | return f'File "{file_name}" created successfully!' 15 | else: 16 | return 'Please provide both file name and data.' 17 | 18 | return ''' 19 | 20 | 21 | 22 | 23 | 24 | Create File 25 | 26 | 27 |
28 | 29 | 30 | 31 | 32 | 33 |
34 | 35 | 36 | ''' 37 | 38 | if __name__ == '__main__': 39 | app.run(debug=True) 40 | --------------------------------------------------------------------------------