Python Forum
Python variable and function usage at a time
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python variable and function usage at a time
#13
(Sep-24-2020, 01:11 PM)buran Wrote: Ah, OK
they complain because we use my_sum also inside the function and their check "thinks" it is hardcoded

def adds_numbers(x, y):
    return x + y
my_sum = adds_numbers(10, 31) 
print(my_sum)
or just use different name inside the function

def adds_numbers(x, y): 
    result = x + y 
    return result
my_sum = adds_numbers(10, 31) 
print(my_sum)

I tried both the options but validition2 got fail again

Checking if the my_sum variable is not hard-coded.

Description
Searched your code for a specific pattern:

my_sum\s*=\s*(10|31)\s*\+\s*(10|31)
Reply


Messages In This Thread
RE: Python variable and function usage at a time - by prasanthbab1234 - Sep-24-2020, 01:25 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  usage of ":" zeppos 1 660 Dec-12-2023, 10:11 AM
Last Post: buran
  Simple animation -- time evolution of function schniefen 0 1,123 Nov-20-2022, 08:05 PM
Last Post: schniefen
  New to Python - tiny coding assistance on user input function and assign to variable Mountain_Duck 1 2,625 Mar-23-2019, 06:54 PM
Last Post: Yoriz
  Creating a variable that displays time groovydingo 3 3,050 Apr-17-2018, 04:46 AM
Last Post: tannishpage

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020