Python
  • Getting Started
    • Input and Output
    • Variables
    • Data Types
    • Conditional Structures
      • Humidity Level
      • Financial Transactions
      • Fruit-Vending Machine
      • Magic While
      • FizzBuzz
    • Functions
      • Hashtag Generator
  • Data Structures
    • Lists
    • Dictionary
    • Set
    • Interpreter Expressions
  • OOPs
    • Classes and Objects
    • Exception Handling
      • Simple Calculator
  • System Programming
    • File Operations
    • Directory Navigation
    • Process Creation
    • Threads
Powered by GitBook
On this page
  1. Getting Started
  2. Functions

Hashtag Generator

Task

Complete the program to output the input text starting with the hashtag (#). Also, if the user entered several words, the program should delete the spaces between them.

Sample Input

  • code sleep eat repeat

Sample Output

  • #codesleepeatrepeat

s = input()

def hashtagGen(text):
	#your code goes here
	
	output = "".join("#" +s).replace(" ","")
	return output

print(hashtagGen(s))
PreviousFunctionsNextLists

Last updated 2 years ago