2.2.2 Data Types Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What are the 4 data types?

A

Integer
String
Real/Float
Boolean

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is an integer?

A

Chain of characters eg. “Hello”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is Real/Float?

A

Value with a decimal place eg. 10.5, 20.3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is an integer?

A

Whole number eg. 10,20,30,40

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is Boolean?

A

Value that are either true or false?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is casting?

A

Changing one data type into another
eg. str(25) change to str
int(“48”) change to int
Float(“10.5”) change to float

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is concatenation?

A

Joining string to each other
Ans=str(A)+B
Print(Ans)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Write a program that asks
name - str
age - int
height - float
subject - str

A

name = str(input(“please enter your name”))
age = int(input(“please enter your age”))
height = float(input(“please enter your height”))
subject =str(input(“please enter your favourite subject”))
print(“Hello there” + name + “you are” + str(age). “Your height is” + str(height) + “And your favourite subject is” + subject)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is string handling?

A

upper()
lower()
title()
replace()

str = “Computer Science”
str.upper() = will convert string into uppercase
str.lower() = wil convert string into lowercase
str.title() = capitalise first letter of every word
str.replace(“C”,”P”) = Pomputer Spienpe
len(str) = Show number of characters in the string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly