Python Challenge 24 - HELP NEEDED WRITING THIS CODE | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Python Challenge 24 - HELP NEEDED WRITING THIS CODE

I need to write the following into python code but I am currently struggling with a few things; here is the written description of what I need to convert to Python Python challenge 24: Write a function that takes two numbers. The first number indicates the number of spaces that should be displayed The second shows the number of Xs that should be displayed. These should both be displayed on the same line. Now write another function that makes multiple calls to your first function and draws a picture with Xs.

27th Oct 2016, 7:17 PM
6085
6085 - avatar
5 Answers
+ 4
Here is a really simple code in Python, it could be enhanced to print some more complex shapes.. https://code.sololearn.com/c7oSEHZTPmsV/
9th Sep 2017, 10:26 AM
noobcøder
noobcøder - avatar
+ 2
the description is not clear. what picture are you trying to achieve? spaces and X on one line could give you the size of every line (andd subsequentlly the size of the whole picture) in charachters. I presume that the function that makes multiple calls to the size of every line shold take care of arranging such char on the in order to build a picture line by line. In your description is missing the logic of this charachters arrangement.
28th Oct 2016, 6:53 PM
seamiki
seamiki - avatar
+ 1
def function(space, star): print(" "*space+"X"*star) def doManyTimes(function, number): for i in range(number): function(space, star) space=int(input("how many spaces?")) star=int(input("how many X?")) number=int(input("how many row?")) doManyTimes(function, number) it works for me. in codeplayground you should give the input in multiple line at the first prompt, it doesnt ask you one by one.
30th Nov 2016, 9:15 AM
Benedek Máté Tóth
Benedek Máté Tóth - avatar
0
@seamiki I was given that task the way you see it and thats why am confused
30th Oct 2016, 10:33 AM
6085
6085 - avatar
0
can someone help me this is my summer homework please help me solve this challenge am stuck
8th Aug 2018, 12:34 PM
hwefwb