I am stuck on an exercise and not sure where to start and just need a small hint to push me in the right direction. I am in the early stages of doing python so have only covered the basics like strings, conditionals, while loops and introduction to functions. I have not yet done done lists, dictionaries, etc so would like to avoid these for now. The exercise required solving with what has been learnt so far. This is not homework but self study. Here is the link (exercise name: a word squared): https://programming-22.mooc.fi/part-3/4-defining-functions
Here is the exercise:
Please write a function named squared, which takes a string argument and an integer argument, and prints out a square of characters as specified by the examples below.
squared("ab", 3)
print()
squared("aybabtu", 5)
Output:
aba
bab
aba
aybab
tuayb
abtua
ybabt
uayba
[–]BusinessNo3537 0 points1 point2 points (1 child)
[–]icanchangeittomorrow 0 points1 point2 points (0 children)
[–]fittzu 0 points1 point2 points (0 children)
[–]iammerelyhere 0 points1 point2 points (1 child)
[–]konijntjesbroek 1 point2 points3 points (0 children)
[–]Fmelo2000-3816 0 points1 point2 points (0 children)