Загрузить файлы в «/»
This commit is contained in:
		
						commit
						5ec8073364
					
				
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,2 @@
 | 
				
			|||||||
 | 
					.venv/
 | 
				
			||||||
 | 
					output.txt
 | 
				
			||||||
							
								
								
									
										1
									
								
								output.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								output.txt
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					ПРИВЕТ  МИР
 | 
				
			||||||
							
								
								
									
										15
									
								
								script.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								script.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,15 @@
 | 
				
			|||||||
 | 
					# Создаём соответствие номеров букв и самих букв русского алфавита
 | 
				
			||||||
 | 
					alphabet = {i + 1: letter for i, letter in enumerate("АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ")}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Читаем закодированный текст из файла data.txt
 | 
				
			||||||
 | 
					with open("data.txt", "r", encoding="utf-8") as file:
 | 
				
			||||||
 | 
					    numbers = file.read().strip().split(" ")  # Разделяем по одиночному пробелу, чтобы сохранить их
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Преобразуем числа в буквы, а пробелы оставляем
 | 
				
			||||||
 | 
					decoded_text = "".join(alphabet.get(int(num), " ") if num.isdigit() else " " for num in numbers)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Записываем результат в output.txt
 | 
				
			||||||
 | 
					with open("output.txt", "w", encoding="utf-8") as output_file:
 | 
				
			||||||
 | 
					    output_file.write(decoded_text)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					print("Файл output.txt создан с расшифрованным текстом.")
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user