I am not sure what is your background but maybe it helps to understand better if there is used java/c# syntax. Python use indentation to show what belongs to nested block. As you have for and if they will be executed sequentially
def func_calc(a,b):
for i in range(len(a)):
exam1 = a[i]
homework1= b[i]
if a[i] < 60:
print (a[i])
else:
print(0.70*exam1+0.30*homework1)
rewritten to other language will be executed as
void func_calc(a,b){
for (i = 0; i < a.Length(a); i++){
exam1 = a[i]
homework1= b[i]
}
if(a[i] < 60){
print (a[i])
}
else{
print(0.70*exam1+0.30*homework1)
}
}
So simply indent if so it is executed as part of your for loop
def func_calc(a,b):
for i in range(len(a)):
exam1 = a[i]
homework1= b[i]
if a[i] < 60: # this is indented
print (a[i]) # this is indented
else: # this is indented
print(0.70*exam1+0.30*homework1) # this is indented
Equivalent in java/c# will be
void func_calc(a,b){
for (i = 0; i < a.Length(a); i++){
exam1 = a[i]
homework1= b[i]
if(a[i] < 60){
print (a[i])
}
else{
print(0.70*exam1+0.30*homework1)
}
}
}