please, help ! Write what the mistake is, and if you are still the kindest programmer, write down how to fix a terrible mistake. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

please, help ! Write what the mistake is, and if you are still the kindest programmer, write down how to fix a terrible mistake.

text=int(input("you text")) r=int(input("pyramid size")) i=1 k=1 j=i def p(): global text global r global i global k global j while i<=r: i+1 while j<=n: print (" ") j=i while k<=2*i-1: k+1 print (text) break

5th Nov 2021, 6:51 PM
webartem_ OF
webartem_ OF - avatar
1 Answer
+ 3
Hi! Start with put your assingment of the indices inside the function and take away all globals. And ’break’ needs to be inside your while statement. You also need parameters in your def, so you can assign value to the function, like: def p(text, r): Then you have to run (call) your function, like p(text, r) You have also an uninitialized variable n; assign it to an integer. It is confusing to convert a input text to a integer: text = int(input(’input your txt’)) Take away int() around input! Work with your indentations! In a function, instead of break, you normaly use return. Take away your break!
5th Nov 2021, 7:00 PM
Per Bratthammar
Per Bratthammar - avatar