Making a contact management system. Please help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Making a contact management system. Please help

The given program declares two variables, name and age. Complete the code to output "name is age years old", where name and age are the declared variable values. name = "James" age = "42"

7th Aug 2022, 6:51 PM
Samuel Adesanya
20 Answers
+ 6
Samuel Adesanya , Pavan Kuncham , it is simpler to use this notation instead of using `+` and concatenation. we don't need to handle additional spaces in the string. just use commas to separate the arguments inside print() function: print(name, "is", age, "years old")
7th Aug 2022, 8:30 PM
Lothar
Lothar - avatar
+ 5
Please read the previous lesson again. Compare for example print("a+b") and print("a"+"b").
7th Aug 2022, 7:19 PM
Lisa
Lisa - avatar
+ 4
der james Show your complete code so we can check on what you tried.
19th Feb 2023, 11:29 AM
Lisa
Lisa - avatar
+ 3
What have you tried so far? Re-read the lessons and show your code attempt please.
7th Aug 2022, 7:10 PM
Lisa
Lisa - avatar
+ 3
der james Your code is _Java_. This thread is about the _Python_ task. You can concatenate strings with +. Pay attention to blank spaces.
19th Feb 2023, 11:43 AM
Lisa
Lisa - avatar
+ 2
please i need the complete code from the beginning
19th Sep 2023, 4:48 PM
Achievement Tiffany
Achievement Tiffany - avatar
+ 2
Achievement Tiffany The question has been answered. Read the previous posts.
19th Sep 2023, 5:06 PM
Lisa
Lisa - avatar
+ 1
I have read the lesson countless times and I've even gone through the comments below each lesson and I don't seem to be getting it, maybe I need a little help. This is my attempt below: name = "James" age = "42" print ("name+is+age+years+old")
7th Aug 2022, 7:16 PM
Samuel Adesanya
+ 1
Lothar ok bro and thank you for extra information
7th Aug 2022, 8:37 PM
Pavan Kuncham
+ 1
print("name is "+name+" "+age+" years old")
8th Aug 2022, 2:26 AM
Kailash Yandrapu
0
The expected output is: James is 42 years old
7th Aug 2022, 7:05 PM
Samuel Adesanya
0
name = "James" age = "42" Print(name+" is"+age+" years old")
7th Aug 2022, 7:22 PM
Pavan Kuncham
0
Somebody an idea? Not a single one of your Tips Do work
19th Feb 2023, 11:25 AM
der james
der james - avatar
0
public class Program { public static void main(String[] args) { String name = "Howard"; int age = 42; System.out.println(name"is"age"years old"); } }
19th Feb 2023, 11:30 AM
der james
der james - avatar
0
The example from pavan and Samuel does Not work either
19th Feb 2023, 11:30 AM
der james
der james - avatar
0
Dont know what is wrong
19th Feb 2023, 11:30 AM
der james
der james - avatar
0
Lisa do u got an answer for me?
19th Feb 2023, 11:42 AM
der james
der james - avatar
0
Oh sorry okay
19th Feb 2023, 11:43 AM
der james
der james - avatar
0
der james are you getting any errors while running the code that which you have posted
2nd Apr 2023, 10:33 AM
Kailash Yandrapu
0
der james this is the updated code in java public class Program { public static void main(String[] args) { String name = "Howard"; int age = 42; System.out.println("name is "+name+" "+age+" years old"); } }
2nd Apr 2023, 10:40 AM
Kailash Yandrapu