UrbanPro

Learn Python Training from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

X=4 Y=X+4 Y=INT(STR(Y)+'2') PRINT(Y)

Asked by Last Modified  

25 Answers

Learn Python

Follow 0
Answer

Please enter your answer

Expert Programmer

82
Comments

Here is how it works: 1. X takes the value of 4 2. Y takes the value of 8 ( Y=X+4 ) 3a. str(Y) is evaluated as '8' 3b. next, str(Y)+'2' is evaluated - this gives us '82' 3c. next, INT('82') gets evaluated - which returns 82 and assigns it to Y. 4. No wonder 82 is printed.
Comments

82
Comments

22 Years Experienced Python Coding Computer Science ICT AI Java Maths Gurugram Tuitions Classes 6-12

This will print 82 and the for the reason, please have a look at the answer by Rajaram as it is well explained
Comments

82
Comments

Software Programmer

82
Comments

Advance C-Embedded

82
Comments

Tutor

INT, STR and PRINT have to be in lower case, else nothing is going to work. Python needs all functions to be defined in lower case. Then the answer would be 82 as everybody else has pointed out.
Comments

10
Comments

Tutor

Hello Annu, Please find below for the detailed explanation X=4 print 'X:', X, type(X) Y=X+4 print 'Y:', Y, type(Y) print 'str(Y)---', str(Y), type(str(Y)) print "str(Y)+'2'---", str(Y)+'2', type(str(Y)+'2') print "int(str(Y)+'2') ======", int(str(Y)+'2'), type(int(str(Y)+'2')) Y=int(str(Y)+'2') print...
read more
Hello Annu, Please find below for the detailed explanation X=4 print 'X:', X, type(X) Y=X+4 print 'Y:', Y, type(Y) print 'str(Y)---', str(Y), type(str(Y)) print "str(Y)+'2'---", str(Y)+'2', type(str(Y)+'2') print "int(str(Y)+'2') ======", int(str(Y)+'2'), type(int(str(Y)+'2')) Y=int(str(Y)+'2') print type(Y) ======================================== python .\sample-exp.py X: 4 type 'int' Y: 8 type 'int' str(Y)--- 8 type 'str' str(Y)+'2'--- 82 type 'str' int(str(Y)+'2') ====== 82 type 'int' type 'int' PS F:\Python ====================================================== Point-1: Initially both the variables X,Y are integers Point-2: At step-3 you converted variable 'Y' to string and concatenated('+') with '2' which resulted '82', a string This string '82' was again converted to int by the python int function The result is a integer value 82 for the variable 'Y' point-3: At step-4 you printed Y value which will be an integer output. You can use type() function to check, which class the variable belongs to. read less
Comments

View 23 more Answers

Related Questions

Which should I learn: Python or PHP?
Would depend on your goals but these days python is fairly popular in solving web development related tasks with ease.
Sarath Chandra
0 0
5
Is Python an easy language to learn?
While Python is considered one of the easiest programming languages for a beginner to learn, it can be hard to master. Anyone can learn Python if they work hard enough at it, but becoming a Python Developer...
Hariprasad
0 0
5

Is learning Tally good or is learning Advanced Excel and Python good? Which one will be better for getting a job? What would be the general cost of learning Tally, Advanced Excel and Python? Which are the best tutors or institutes near to Kudlu Gate and Electronic City?

 

 

As a beginner, you should go with Advance Excel and MIS reporting. After that, you can go for VBA, SQL, and Python in the end. Follow this career path. You will end up being a data analyst and package raging from 8-12lakh pa.
Prabhu
Can we code a website from python?
Yes, you can build a website with python. Python is a general purpose programming language. some of the benifits of building a web with python they are below. Easy to learn. Large library collection. Fast...
Mridulika
0 0
5

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Benefits of Design Patterns in Application Development
Application developments is a tedious job. Programmers write code and test it again and again to make sure their software works fine. So designing complex software is a hard nut to crack. Skilled programmers...

Python in Unix
Python in Unix How to run command on unix Commands cannot be run directly on a unix server like we do in shell script. SYNTAX: system("Command") check_output("Command", shell=True) call("Command",...
R

Rishi B.

0 0
0

Python- 5 reasons to learn python
1. Dynamically Typed You don’t have to declare a type when declaring a variable. It skips headaches of type casting JAVA:- int x = 1; x = (int) x/2;...

map function in python
The function map takes a function and an iterable as arguments and returns a new iterable with the function applied to each argument. Example: def add_five(x): return x+5 nums = result = list(map(add_five,...

OS Module
1. OS module interacts with your operating system. Use this to create folder, remove folder, move folder, change the working directory. Ex: import oscurDir=os.getcwd() #get current working directoryprint(curDir)os.mkdir('praveen')...

Recommended Articles

Python is one of the most popular programming languages in the world. It is general-purpose, object oriented, high-level programming language used in a number of programming fields. Python is a great programming language to learn as it will introduce you to the world of programming. If you are from the technical background...

Read full article >

Business Process outsourcing (BPO) services can be considered as a kind of outsourcing which involves subletting of specific functions associated with any business to a third party service provider. BPO is usually administered as a cost-saving procedure for functions which an organization needs but does not rely upon to...

Read full article >

Microsoft Excel is an electronic spreadsheet tool which is commonly used for financial and statistical data processing. It has been developed by Microsoft and forms a major component of the widely used Microsoft Office. From individual users to the top IT companies, Excel is used worldwide. Excel is one of the most important...

Read full article >

Applications engineering is a hot trend in the current IT market.  An applications engineer is responsible for designing and application of technology products relating to various aspects of computing. To accomplish this, he/she has to work collaboratively with the company’s manufacturing, marketing, sales, and customer...

Read full article >

Looking for Python Training classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for Python Training Classes?

The best tutors for Python Training Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Python Training with the Best Tutors

The best Tutors for Python Training Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more