Monday 4 April 2022

Rules of Naming a variable in python?

 


This article describes the standards that apply to variable names. All of the listed recommendations are mandatory unless noted otherwise.


Rules of Naming a Variable in Python:

  • A variable name must start with a letter or the underscore character
  • A variable name cannot start with a number
  • A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
  • Variable names are case-sensitive (age, Age, and AGE are three different variables)

# valid variable names

myV = 1

testVar = "var"

_thisVar = 20.2

_Thisvar = "testing"

Test_Var = "good"

TestVar = "testin"


# invalid variable names

-variable = 12

3variable = "badName"

my variable = "error"



Multiple Variable Assignment:

You can assign values to any number of variable in a single line, see the example below–

Example

x, y, z = 1, 2, 3

print(x)

print(y)

print(z)

Output

1

2

3


Learn (API-Microservice)Testing+(CoreJava+UI)-SDET with Self Paced Videos and one LIVE Doubt Session

SDET TRANING VIDEOS AVAILABLE with Live Doubt Session(course-1 below,API TRaining Videos With ClassNotes and Coding Set) and (API+UI, both course-1 & 2 below) Check Training Page for Course Content or reach out @whatsapp +91-9619094122

Check below link for question and answers with the code:

Top API Interview Question 1-10

Top API INterview Questions 11-20 

Top API AUTOMATION Interview Q&A - 21-30

*************************************************

SeleniumWebdriver Automation Testing Interview Questions:

https://automationreinvented.blogspot.com/search/label/SeleniumWebdriver

API Testing Interview Question Set:

https://automationreinvented.blogspot.com/search/label/Rest-API

 

Kubernetes Interview Question Set

https://automationreinvented.blogspot.com/search/label/Kubernetes

 

Docker Interview Question Set

https://automationreinvented.blogspot.com/2020/02/top-18-docker-commands-for-aytomation.html

Linux Interview question Set

https://automationreinvented.blogspot.com/search/label/Linux

Automation Testing/SDET Framework Design

https://automationreinvented.blogspot.com/search/label/FrameworkDesign

Java Related Interview Question Set

https://automationreinvented.blogspot.com/search/label/Java

GIT Interview Question Set:

https://automationreinvented.blogspot.com/search/label/GIT

Coding Interview Question Set:

https://automationreinvented.blogspot.com/search/label/Coding%20Questions

Mobile Testing Interview Question Set:

https://automationreinvented.blogspot.com/search/label/Mobile%20Testing

Python Interview Question Set for QAE - SDET - SDE:

https://automationreinvented.blogspot.com/search/label/Python



No comments:

Post a Comment

All Time Popular Posts

Most Featured Post

Introduction to Web Testing with Playwright

  Introduction to Web Testing with Playwright 📌  Telegram Group:  https://t.me/+FTf_NPb--GQ2ODhl 📌  YouTube channel:  https://lnkd.in/gGUG...