Pastebin
API
tools
faq
paste
Login
Sign up
Please fix the following errors:
New Paste
Syntax Highlighting
class Printer: def __init__(self): self.printers = [ { "Название": "Creality3D HALOT-R6", "Тип": "3Д-принтер", "Цена": 15999, "Отзывы": "да", "Фирма": "Creality3D", "Материал": ["фотополимерная смола"], "Скорость": 60, }, { "Название": "Anycubic Kobra 2 Neo", "Тип": "3Д-принтер", "Цена": 22999, "Отзывы": "да", "Фирма": "Anycubic", "Материал": ["petg, pla", "abs"], "Скорость": 150, }, { "Название": "Elegoo Mars 5", "Тип": "3Д-принтер", "Цена": 29999, "Отзывы": "да", "Фирма": "Elegoo", "Материал": ["фотополимерная смола"], "Скорость": 70, }, { "Название": "Flying bear Ghost 6", "Тип": "3Д-принтер", "Цена": 37999, "Отзывы": "нет", "Фирма": "Flying bear", "Материал": ["petg, pla", "abs"], "Скорость": 150, }, { "Название": "Wanhao Duplicator 11 CGR 4K", "Тип": "3Д-принтер", "Цена": 129900, "Отзывы": "нет", "Фирма": "Wanhao", "Материал": ["фотополимерная смола"], "Скорость": 60, }, { "Название": "Epson lx350", "Тип": "Матричный", "Цена": 26199, "Отзывы": "да", "Иглы": 9, "Скорость": 347, }, { "Название": "Epson lq350", "Тип": "Матричный", "Цена": 27999, "Отзывы": "да", "Иглы": 24, "Скорость": 347, }, { "Название": "Epson FX-890II", "Тип": "Матричный", "Цена": 106499, "Отзывы": "нет", "Иглы": 18, "Скорость": 738, }, { "Название": "HP LaserJet Pro 500 M501dn", "Тип": "Лазерный", "Цена": 48999, "Отзывы": "да", "Фирма": "HP", "Печать": "черно-белая", "Разрешение": "600x600", "Скорость": 43, "wifi": "да", "Формат": "A4", }, { "Название": "Xerox Cumshot-2217", "Тип": "Лазерный", "Цена": 121999, "Отзывы": "нет", "Фирма": "Xerox", "Печать": "цветная", "Разрешение": "1200x1200", "Скорость": 32, "wifi": "да", "Формат": "A4", }, { "Название": "Brother HL-1110", "Тип": "Лазерный", "Цена": 10199, "Отзывы": "да", "Фирма": "Brother", "Печать": "черно-белая", "Разрешение": "2400x600", "Скорость": 20, "wifi": "нет", "Формат": "A4", }, { "Название": "Pantum P2200", "Тип": "Лазерный", "Цена": 10799, "Отзывы": "нет", "Фирма": "Pantum", "Печать": "черно-белая", "Разрешение": "1200x1200", "Скорость": 20, "wifi": "нет", "Формат": "A4", }, { "Название": "Canon Yana3800", "Тип": "Лазерный", "Цена": 32999, "Отзывы": "да", "Фирма": "Canon", "Печать": "цветная", "Разрешение": "2400x600", "Скорость": 16, "wifi": "нет", "Формат": "A3", }, ] class PrinterQuestionnaire: def __init__(self): self.questions = { "printer_type": { "question": "Какой тип принтера вам нужен?", "options": ["3Д-принтер", "Матричный", "Лазерный"], "multi_choice": False }, "printer_budget": { "question": "Какой у вас бюджет?", "options": ["до 10", "до 30", "до 100", "до 200"], "multi_choice": False }, "printer_reviews": { "question": "Важна ли вам оценка принтера согласно другим пользователям (средняя оценка принтера)?", "options": ["да", "нет"], "multi_choice": False }, "printer_use": { "question": "Для каких нужд вам нужен 3д принтер?", "options": ["любительская печать 3д моделей", "печать 3д моделей для производства", "профессиональная 3д печать"], "multi_choice": False }, "printer_manufacture": { "question": "Какой фирме вы отдаете предпочтение?", "options": ["Creality3D", "Anycubic", "Elegoo", "Flying bear", "Wanhao", "не важно"], "multi_choice": True }, "printer_material": { "question": "Какой материал вы будете использовать?", "options": ["фотополимерная смола", "abs, asa, ptg", "petg, pla", "Carbon", "не важно"], "multi_choice": True }, "printer_speed": { "question": "Какая скорость нужна?", "options": ["до 150", "до 300", "от 300", "не важно"], "multi_choice": False }, "printer_needle_count": { "question": "Сколько игл вам нужно в принтере?", "options": ["не важно", "от 9", "от 20"], "multi_choice": False }, "printer_print_type": { "question": "Какой тип печати нужен?", "options": ["цветной", "черно-белый"], "multi_choice": False }, "printer_resolution": { "question": "Какое разрешение нужно?", "options": ["600x600", "1200x1200", "2400x600", "не важно"], "multi_choice": False }, "printer_wifi": { "question": "Важно ли наличие WI-FI?", "options": ["да", "нет"], "multi_choice": False }, "printer_format": { "question": "Какой формат печати нужен?", "options": ["A4", "A3"], "multi_choice": False } } self.printer = Printer() def ask_question(self, question_key): question_data = self.questions.get(question_key) if not question_data: return None question = question_data["question"] options = question_data["options"] is_multi_choice = question_data["multi_choice"] print(question) for i, option in enumerate(options, 1): print(f"{i}) {option}") while True: try: choice = list(map(int, input("Введите номера через запятую: ").strip().lower().split(","))) except ValueError: print("Ошибка: введите только числа, разделенные запятыми.") continue if len(choice) > 1 and not is_multi_choice: print("Введите только одно число") continue is_correct = True for i in choice: if i > len(options) or i < 1: print("Ошибка: введите номер из списка") is_correct = False break if is_correct: selected_options = [options[i - 1] for i in choice] return choice, selected_options def filter_printers(self, answers): filtered_printers = [] total_conditions = len(answers) # Общее количество условий for printer in self.printer.printers: match_count = 0 # Счетчик совпадений if "printer_type" in answers and printer["Тип"].lower() == answers["printer_type"][0].lower(): match_count += 1 if "printer_budget" in answers: budget = answers["printer_budget"][0] if budget == "до 10" and printer["Цена"] <= 10000: match_count += 1 elif budget == "до 30" and printer["Цена"] <= 30000: match_count += 1 elif budget == "до 100" and printer["Цена"] <= 100000: match_count += 1 elif budget == "до 200" and printer["Цена"] <= 200000: match_count += 1 if "printer_reviews" in answers and answers["printer_reviews"][0].lower() == printer["Отзывы"].lower(): match_count += 1 if printer["Тип"] == "3Д-принтер": if "printer_use" in answers and answers["printer_use"][0].lower() in [u.lower() for u in printer.get("Предназначение", [])]: match_count += 1 if "printer_manufacture" in answers: if "не важно" in answers["printer_manufacture"] or printer["Фирма"].lower() in [m.lower() for m in answers[ "printer_manufacture"]]: match_count += 1 if "printer_material" in answers: if "не важно" in answers["printer_material"] or any( material.lower() in [m.lower() for m in answers["printer_material"]] for material in printer["Материал"]): match_count += 1 if "printer_speed" in answers: speed = answers["printer_speed"][0] if speed == "до 150" and printer["Скорость"] <= 150: match_count += 1 elif speed == "до 300" and printer["Скорость"] <= 300: match_count += 1 elif speed == "от 300" and printer["Скорость"] >= 300: match_count += 1 if printer["Тип"] == "Матричный": if "printer_needle_count" in answers: needles = answers["printer_needle_count"][0] if needles == "не важно": match_count += 1 elif needles == "от 9" and printer["Иглы"] >= 9: match_count += 1 elif needles == "от 20" and printer["Иглы"] >= 20: match_count += 1 if "printer_speed" in answers: speed = answers["printer_speed"][0] if speed == "347" and printer["Скорость"] == 347: match_count += 1 elif speed == "738" and printer["Скорость"] == 738: match_count += 1 if printer["Тип"] == "Лазерный": if "printer_manufacture" in answers: if "не важно" in answers["printer_manufacture"] or printer["Фирма"].lower() in [m.lower() for m in answers[ "printer_manufacture"]]: match_count += 1 if "printer_print_type" in answers and printer["Печать"].lower() == answers["printer_print_type"][ 0].lower(): match_count += 1 if "printer_resolution" in answers: if "не важно" in answers["printer_resolution"] or printer["Разрешение"].lower() == \ answers["printer_resolution"][0].lower(): match_count += 1 if "printer_speed" in answers: speed = answers["printer_speed"][0] if speed == "до 20 стр/мин" and printer["Скорость"] <= 20: match_count += 1 elif speed == "до 30 стр/мин" and printer["Скорость"] <= 30: match_count += 1 elif speed == "до 40 стр/мин" and printer["Скорость"] <= 40: match_count += 1 elif speed == "выше 40 стр/мин" and printer["Скорость"] > 40: match_count += 1 if "printer_wifi" in answers and printer["wifi"].lower() == answers["printer_wifi"][0].lower(): match_count += 1 if "printer_format" in answers and printer["Формат"].lower() == answers["printer_format"][0].lower(): match_count += 1 # Проверяем, соответствует ли принтер 70% условий if match_count / total_conditions >= 0.7: filtered_printers.append(printer) return filtered_printers def run_questionnaire(self): print("Вас приветствует программа выбора принтера!") print("Отвечайте на вопросы, написанием цифры") answers = {} answers["printer_type"] = self.ask_question("printer_type")[1] answers["printer_budget"] = self.ask_question("printer_budget")[1] answers["printer_reviews"] = self.ask_question("printer_reviews")[1] if answers["printer_type"][0] == "3Д-принтер": answers["printer_use"] = self.ask_question("printer_use")[1] answers["printer_manufacture"] = self.ask_question("printer_manufacture")[1] answers["printer_material"] = self.ask_question("printer_material")[1] answers["printer_speed"] = self.ask_question("printer_speed")[1] elif answers["printer_type"][0] == "Матричный": answers["printer_needle_count"] = self.ask_question("printer_needle_count")[1] answers["printer_speed"] = self.ask_question("printer_speed")[1] elif answers["printer_type"][0] == "Лазерный": answers["printer_manufacture"] = self.ask_question("printer_manufacture")[1] answers["printer_print_type"] = self.ask_question("printer_print_type")[1] answers["printer_resolution"] = self.ask_question("printer_resolution")[1] answers["printer_speed"] = self.ask_question("printer_speed")[1] answers["printer_wifi"] = self.ask_question("printer_wifi")[1] answers["printer_format"] = self.ask_question("printer_format")[1] recommended_printers = self.filter_printers(answers) if recommended_printers: print("\nРекомендуемые принтеры:") for printer in recommended_printers: print(f"\nНазвание: {printer['Название']}") print(f"Тип: {printer['Тип']}") print(f"Цена: {printer['Цена']} руб.") if "Фирма" in printer: print(f"Фирма: {printer['Фирма']}") if "Материал" in printer: print(f"Материалы: {', '.join(printer['Материал'])}") if "Скорость" in printer: print(f"Скорость: {printer['Скорость']}") if "Иглы" in printer: print(f"Иглы: {printer['Иглы']}") if "Печать" in printer: print(f"Тип печати: {printer['Печать']}") if "Разрешение" in printer: print(f"Разрешение: {printer['Разрешение']}") if "wifi" in printer: print(f"Wi-Fi: {printer['wifi']}") if "Формат" in printer: print(f"Формат: {printer['Формат']}") else: print("\nК сожалению, подходящих принтеров не найдено.") print("\nБюджет:", ', '.join(answers["printer_budget"])) print("Важны ли отзывы:", ', '.join(answers["printer_reviews"])) questionnaire = PrinterQuestionnaire() questionnaire.run_questionnaire()
Optional Paste Settings
Category:
None
Cryptocurrency
Cybersecurity
Fixit
Food
Gaming
Haiku
Help
History
Housing
Jokes
Legal
Money
Movies
Music
Pets
Photo
Science
Software
Source Code
Spirit
Sports
Travel
TV
Writing
Tags:
Syntax Highlighting:
None
Bash
C
C#
C++
CSS
HTML
JSON
Java
JavaScript
Lua
Markdown (PRO members only)
Objective C
PHP
Perl
Python
Ruby
Swift
4CS
6502 ACME Cross Assembler
6502 Kick Assembler
6502 TASM/64TASS
ABAP
AIMMS
ALGOL 68
APT Sources
ARM
ASM (NASM)
ASP
ActionScript
ActionScript 3
Ada
Apache Log
AppleScript
Arduino
Asymptote
AutoIt
Autohotkey
Avisynth
Awk
BASCOM AVR
BNF
BOO
Bash
Basic4GL
Batch
BibTeX
Blitz Basic
Blitz3D
BlitzMax
BrainFuck
C
C (WinAPI)
C Intermediate Language
C for Macs
C#
C++
C++ (WinAPI)
C++ (with Qt extensions)
C: Loadrunner
CAD DCL
CAD Lisp
CFDG
CMake
COBOL
CSS
Ceylon
ChaiScript
Chapel
Clojure
Clone C
Clone C++
CoffeeScript
ColdFusion
Cuesheet
D
DCL
DCPU-16
DCS
DIV
DOT
Dart
Delphi
Delphi Prism (Oxygene)
Diff
E
ECMAScript
EPC
Easytrieve
Eiffel
Email
Erlang
Euphoria
F#
FO Language
Falcon
Filemaker
Formula One
Fortran
FreeBasic
FreeSWITCH
GAMBAS
GDB
GDScript
Game Maker
Genero
Genie
GetText
Go
Godot GLSL
Groovy
GwBasic
HQ9 Plus
HTML
HTML 5
Haskell
Haxe
HicEst
IDL
INI file
INTERCAL
IO
ISPF Panel Definition
Icon
Inno Script
J
JCL
JSON
Java
Java 5
JavaScript
Julia
KSP (Kontakt Script)
KiXtart
Kotlin
LDIF
LLVM
LOL Code
LScript
Latex
Liberty BASIC
Linden Scripting
Lisp
Loco Basic
Logtalk
Lotus Formulas
Lotus Script
Lua
M68000 Assembler
MIX Assembler
MK-61/52
MPASM
MXML
MagikSF
Make
MapBasic
Markdown (PRO members only)
MatLab
Mercury
MetaPost
Modula 2
Modula 3
Motorola 68000 HiSoft Dev
MySQL
Nagios
NetRexx
Nginx
Nim
NullSoft Installer
OCaml
OCaml Brief
Oberon 2
Objeck Programming Langua
Objective C
Octave
Open Object Rexx
OpenBSD PACKET FILTER
OpenGL Shading
Openoffice BASIC
Oracle 11
Oracle 8
Oz
PARI/GP
PCRE
PHP
PHP Brief
PL/I
PL/SQL
POV-Ray
ParaSail
Pascal
Pawn
Per
Perl
Perl 6
Phix
Pic 16
Pike
Pixel Bender
PostScript
PostgreSQL
PowerBuilder
PowerShell
ProFTPd
Progress
Prolog
Properties
ProvideX
Puppet
PureBasic
PyCon
Python
Python for S60
QBasic
QML
R
RBScript
REBOL
REG
RPM Spec
Racket
Rails
Rexx
Robots
Roff Manpage
Ruby
Ruby Gnuplot
Rust
SAS
SCL
SPARK
SPARQL
SQF
SQL
SSH Config
Scala
Scheme
Scilab
SdlBasic
Smalltalk
Smarty
StandardML
StoneScript
SuperCollider
Swift
SystemVerilog
T-SQL
TCL
TeXgraph
Tera Term
TypeScript
TypoScript
UPC
Unicon
UnrealScript
Urbi
VB.NET
VBScript
VHDL
VIM
Vala
Vedit
VeriLog
Visual Pro Log
VisualBasic
VisualFoxPro
WHOIS
WhiteSpace
Winbatch
XBasic
XML
XPP
Xojo
Xorg Config
YAML
YARA
Z80 Assembler
ZXBasic
autoconf
jQuery
mIRC
newLISP
q/kdb+
thinBasic
Paste Expiration:
Never
Burn after read
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Exposure:
Public
Unlisted
Private
Folder:
(members only)
Password
NEW
Enabled
Disabled
Burn after read
NEW
Paste Name / Title:
Create New Paste
Hello
Guest
Sign Up
or
Login
Sign in with Facebook
Sign in with Twitter
Sign in with Google
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Public Pastes
Trading method
CSS | 1 min ago | 0.28 KB
Google Docs - Exploit
14 min ago | 0.28 KB
SwapEngine Bug [build 1.3]
41 min ago | 0.28 KB
December smells like money
CSS | 54 min ago | 0.28 KB
Untitled
C | 10 hours ago | 0.88 KB
acg
1 day ago | 0.05 KB
AI METHODS
2 days ago | 0.29 KB
Untitled
2 days ago | 0.29 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!