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

Hi all, I'm looking for a tutor who can teach Data Structure, and also Object Oriented Programming w.r.t Python.
Hi, I'm a professional trainer and design consultant, and I do training on Python, AWS, C/C++. I do generally customize the training content and pace based on the student's absorbption level. I have trained...
Jigar

Is python useful for app development?

Android doesn't support python but you can convert easily python to android app.
Prachi

What is a Python development, UGI, Data science and Machine learning? Do they all include Python or are they different? Which is better to learn for making a career?

Python development is a field in which you develop real world applications using the Python programming language. UGI stands for Upper Gastrointestinal and it is a concept in human body. Data Science is...
Srinu
I want to learn Python in a month. Please help me for this.
Hi Gourab. I teach Python from basic level to advanced topics ---- teach them online. If you are interested , please contact me. I have a total IT experience of over 28 years and a regular Corporate and Individual Trainer.
Gourab

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

Ask a Question

Related Lessons

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 Script for random Password generation
from random import randintdef passwordgen(request): str_not_include = "1 L I i l o O 0" str_small ="abcdefghjkmnpqrstuvwxyz" str_caps = str_small.upper() str_num = "23456789" str_special...

Why Python
Python can be used in any futuristics technology A= Analytics Data Science Artificial Intelligence(AI) Neural Network(NN) Natural Language Processing(NLP) Computer Vision(OpenCV) In Analytics...

Learn Python : Slicing out an email address
We take a small task of slicing out the username and domain name from an email address. We ask the user to type his email address. We take his email address and slice out first his username and then the...
B

Biswanath Banerjee

0 0
0

What is M.S.Project ?
MICROSOFT PROJECT contains project work and project groups, schedules and finances.Microsoft Project permits its users to line realistic goals for project groups and customers by making schedules, distributing...

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