+ 1
Happy New Year , please help me solve the problem in python
You are given a code in the Pascal programming language and your task is to find how many times the operator word "begin" appears in this code. Input data: Pascal code Output: Problem solution
2 Answers
+ 5
Julian Zimpel ,
it is not seen as a helpful behavior when we are going to post a code, as long as the op has not shown his attempt here.
it is helpful to give hints and tips, so that the op has a chance to find a solution by himself.
>> besides of this, the code shown has several issues:
count= 0
with open("yourfilename here", r) as f # missing colon at the end of the line, missing quotes with r
for line in f.readline: # missing parenthesis for readline. but even if they are used => error
a = split(" ", line) # missing indentation, wrong using of split()
count += a.count("begin") # missing indentation
0
Thanks, but I have a problem the input data. How I can input data? https://algo.ubtuit.uz/problem/432 this problem. I don't know English well