livepython.net

81. Python Program to Remove Spaces from a Sentence

Mediumfor loop

Overview

A for loop over a string, with an if that decides which characters to keep.

Problem Statement

Read a sentence and print it on one line with every space removed. You haven't learned any string methods yet: use a for loop. For example, for hi there sunny:

hitheresunny

Use input() with no prompt text: the tests type the input for you, and a prompt would end up in your output.

Input

One value per line, in this order. Example:

hi there sunny

Output

The output for that example:

hitheresunny

The tests try 4 different inputs.

Learn this firstChapter 10 · Python for Loop: Repeat Code for Each Item
solution.py
# write your code here

EXPECTED OUTPUT

1hitheresunny

YOUR OUTPUT

Press Run to see your output here. Lines are compared with the expected output.