- 1

Find me in Traingle

Create a triangle pattern consisting of random numbers..... and then search a particular number and print the output if present or not

6th Jul 2022, 3:26 PM
Mohesh
Mohesh - avatar
2 Antworten
+ 3
Show us what you‘ve tried, so we can give you tips… But in general just iterate trough your numbers and check if its the number you search for… Or add the numbers into a list and check if your searched is in it
6th Jul 2022, 4:05 PM
Janne
Janne - avatar
0
import random n= random.randint(0,100) h=int(input("Enter the height of the triangle: ")) output=' ' for i in range(h): print((output*(h-i-1))+((str(random.randint(0,50))+' ')*(i+1))) so I have tried this code though it'snot the correct one to genrate triangle consisting of random numbers
7th Jul 2022, 4:25 AM
Mohesh
Mohesh - avatar