Python beginner,did something wrong with the code Beginner

<%= @topic_view.topic.title %>
<%= @topic_view.topic.average_rating %> <%= @topic_view.topic.posts.count { |p| !!p.custom_fields['rating'] } %>

Hey,guys,I would really appreciate your help in this task!Cannot figure out what I am doing wrong in the task.Could somebody fix the code?

In Your code you never declared variable which you use outside the function. if you want to use outside the function declared before using it.

name="xyz"
age=10;

def dog_years(name="Loal",age=6):
    return(age*7)
    
print(str(name)+" you are "+str(age)+" years old in dog years")
1 Like