Click here to Skip to main content
15,891,708 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, I am still to new to programming. This is a project I stumbled upon. I couldn't find any help off Google searches, so I came here. Any help is great.

What I have tried:

Python
#source code in python:

datalist=[]

n=int(input("Enter number of elements: "))

for i in range(n):

data=int(input("Enter number "))

datalist.append(data)

start=0

end=0

check=0

for i in range(len(datalist)):

if(check==0 and datalist[i]==12):

check=1

start=i+1

end=i+1

elif(datalist[i]==12 and check==1):

end=i+1

if(start!=0): #here based on the program index start from 1

print("First occurance index:",start)

print("Last occurance index:", end)

else:

print("index:",0)
Posted
Updated 20-Oct-20 5:56am
v3
Comments
Richard MacCutchan 20-Oct-20 12:33pm    
A better question would be, "how do I learn C#".

1 solution

This is not a code conversion service: we are not here to translate code for you.
Even if we did, what you would end up with would not be "good code" in the target language – they are based on very different frameworks, and what makes something work in one language does not always "translate" directly into another.
So what you end up with is very poor code, that is difficult if not impossible to maintain, that can’t be upgraded nicely, and that will cause you immense headaches if the original is changed. And it’ll be a nightmare to debug if it doesn’t work "straight out of the box".
Instead, use the source code as a specification for a new app written in and for the target language / framework and write it from scratch using the original as a "template". You will get a much, much better result that will save you a lot of time in the long run.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900