1#!/usr/bin/env python3
2
3#
4# This exercise is wrong:
5# https://github.com/zhiwehu/Python-programming-exercises/pull/111/files
6# Given the input in the question the output should be: 1,9,25,49,81
7#
8
9# Question 16
10# Level 2
11
12# Question:
13# Use a list comprehension to square each odd number in a list. The list is input by a sequence
14# of comma-separated numbers.
15# Suppose the following input is supplied to the program:
16# 1,2,3,4,5,6,7,8,9
17# Then, the output should be:
18# 1,3,5,7,9
19
20# Hints:
21# In case of input data being supplied to the question, it should be assumed to be a console input.
22
23values = input('Enter a list of numbers separated by commas\n')
24numbers = [str(int(x) ** 2) for x in values.split(",") if int(x) % 2 != 0]
25print(",".join(numbers))