Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: not enough arguments for format string when using %s

Tags:

People also ask

How do you use %s on a string?

%s specifically is used to perform concatenation of strings together. It allows us to format a value inside a string. It is used to incorporate another string within a string. It automatically provides type conversion from value to string.

How do you use %s %d in Python?

In, Python %s and %d are used for formatting strings. %s acts a placeholder for a string while %d acts as a placeholder for a number. Their associated values are passed in via a tuple using the % operator. This code will print abc 2.

Can you use %s in Python?

One of the older ways to format strings in Python was to use the % operator. You can create strings and use %s inside that string which acts like a placeholder. Then you can write % followed be the actual string value you want to use.

How does %s works in Python?

You can use python for SEO by dropping your reliance on Excel and stop using spreadsheets, by leveraging APIs, automating the boring tasks and by implementing machine learning algorithms.


this is my code

import sys
name = input("Enter your name:")
last_name = input("Enter your last name:")
gender = input("Enter your gender:")
age = input("Enter your age:")
print ("So your name is %s, your last name is %s, you are %s and you are %s years old" % name, last_name, gender, age)

I've searched the topic but I don't understand.