Programming test 1

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

what does integer (int) remove?

('x') removes ''

What does String (Str) add?

('x') the ' '

Convert from one data type to another data type

Casting

What is this called:? numb = input('Enter a number: ') print(numb * 3)

Casting

x_stage2 = str(x_stage1) What is this?

Casting

x_stage1 = 123

Integer variable

y_stage2 = str(y_stage1)

String (Str)

what does it expect when you put input?

a string

How do you convert a string '100' to an integer

int('100')=100

How do you convert a string '100' to an integer

int('x') adds ''

what does float(int(1.6)) do?

it adds removes the ' ' and removes the decimal 1.0

what does float do?

it removes the decimal

what does int(float('1.6')) do?

it removes the decimal and removes the 'x'

How do I multiply a number by 3 numb = input ('Enter a number: ') print (int(numb)*3)

numb = input('Enter a number: ' ) print (int(numb)*3)

Who can tell me a variable type ?

str, int, float


Ensembles d'études connexes

TIOBE - Love and Marriage Quotes

View Set

Importance of Exercise/Health Risks of a Sedentary Lifestyle

View Set

Psych 205 Final - chapter 9 review

View Set