All loaded Python function names are accessible through Global()
Switch to playlist: https://www.youtube.com/watch?v=SdzDaohx-GA&list=PLy-AlqZFg6G8tBTB6FFN68mryG4JlCaf- This project is going to use quite a bit of ...
Python Programming Tutorial - 27 - Building Functions
Visit my website at https://www.thenewboston.com/ for all of my videos and tutorials! Have questions or looking for source code? Check out the forum at ...
at the end, every time you make a function, you should call it by saying "SpeedCalc()".Instead of putting "print(SpeedCalc)", you can either put "print(SpeedCalc())" or just "SpeedCalc()". If you want the person to try putting in the right format after doing it wrong, put "SpeedCalc()" right after the line "print('Wrong format entered')".Of course, don't include the doube quotation marks I put; but you can copy/paste everything inside them.So yeah, basically do SpeedCalc() instead of SpeedCalc.
but here goes:import datetimeimport redistance='100'def SpeedCalc(): time_taken=current_time1-current_time speed=distance/time_takenagain='y'while again=='y': CarReg=input('Please entrer the cars number plate in-XX11 XXX format: ') current_time=datetime.datetime.now().time() current_time.isoformat() if re.match('[A-Z]{2}[0-9]{2}\s[A-Z]{3}', CarReg): print('Right format enetered') else: print('Worng format entered') SecondCamera=input('Press enter for the car to drive by the second camera ') current_time1=datetime.datetime.now().time() current_time1.isoformat() print(SpeedCalc)
mine's not working , im working with python 3.3:
def whatsup(x):
return 'whatsup ' + x
print whatsup('tony')
---------------------------------------------------------------------------------------------
print whatsup('tony')
^
SyntaxError: invalid syntax
Please help!