Difference between %s, %f and %d? | Codecademy (2024)

Skip to ContentMini Arrow Down Icon

This forum is now read-only. Please use our new forums! Go to forums

points

Difference between %s, %f and %d? | Codecademy (1)

Submitted by

Stefan

about 9 years

Can someone explain the difference between %s, %f and %d.Thanks.

Answer 548eac0376b8fee7a6008423

votes

Permalink

The internet tells me “%s - Take the next argument and print it as a string%d - Take the next argument and print it as an int” So it’s the same, but affects the data type of the output.

points

Difference between %s, %f and %d? | Codecademy (2)

Submitted by

Callum Boss

about 9 years

1 comments

Difference between %s, %f and %d? | Codecademy (3) Stefan

about 9 years

Thanks. In the meantime I foung this link if you’re interested: http://stackoverflow.com/questions/15215242/python-2-7-d-s-and-float. Cheers.

Answer 548f5741937676d496009b7d

votes

Permalink

%s refers to a string data type, %f refers to a float data type, and %d refers to a double data type.

points

Difference between %s, %f and %d? | Codecademy (4)

Submitted by

AlexMerryman

about 9 years

1 comments

Difference between %s, %f and %d? | Codecademy (5) Stefan

about 9 years

Thanks. In the meantime I foung this link if you’re interested: http://stackoverflow.com/questions/15215242/python-2-7-d-s-and-float. Cheers.

Difference between %s, %f and %d? | Codecademy (2024)
Top Articles
Latest Posts
Article information

Author: Fredrick Kertzmann

Last Updated:

Views: 6305

Rating: 4.6 / 5 (46 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Fredrick Kertzmann

Birthday: 2000-04-29

Address: Apt. 203 613 Huels Gateway, Ralphtown, LA 40204

Phone: +2135150832870

Job: Regional Design Producer

Hobby: Nordic skating, Lacemaking, Mountain biking, Rowing, Gardening, Water sports, role-playing games

Introduction: My name is Fredrick Kertzmann, I am a gleaming, encouraging, inexpensive, thankful, tender, quaint, precious person who loves writing and wants to share my knowledge and understanding with you.