CodeSolved

Solved Programming Questions & Exercises

Build a proposed username

Practice Easy 2125/ Download 1753 Views

Write a program to create a proposed username for a system. This app should first get the user's name and age from him then by paste the name and age and add the mark_Between these two strands as well as an exclamation mark!At the end of it, make a username and make it in the variableusernameSave. Finally print the built -in username.

For example, if the user enters the name "hooshang" and age 24, the app's username should be as follows:

نام کاربری پیشنهادی: "hooshang_24!"

13 Answers

This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
ferst_name = input('enter ferst name : ')
aeg = input('enter aeg : ')
f_name_or_aeg = (ferst_name,aeg)
if ferst_name == 'hooshang':
    if aeg == '24':
        print ('hooshang_24!')

User 5553 Download Python
name = str(input("enter your name : "))
age = str(input("enter your age : "))

print(f"{name}_{age}!")
Mehrshad Download Python
name=input("what's your name?     ")
age=int(input("how old are you?    "))
print("username------->",name,"_",age,"!")
Shina Download Python
#include <iostream>
#include <cfloat> # To understand the capacity of variables:
#include <cctype>
#include <vector>
#include <list>
#include <ctime>

using namespace std ;

int main() {

    string name ;
    cout << "Name : " ;
    cin >> name ;

    string age ;
    cout << "Age = " ;
    cin >> age ;

    string username = name + "_" + age + "!" ;
    cout << "Username : " << username << endl;


    return 0 ;
}
def samane():
    name = input('name: ')
    age = int(input('age: '))

    username = [f"{name}_{age}!"]
    print(username)
samane()

a=input("wahts your name:")
b=input("how old you:")
print((a+b)+"!")
User 5632 Download Python
<!DOCTYPE html>
<html lang="fa">
<head>
<meta charset="UTF-8" />
<title>Username Generator</title>
<style>
  body {
    font-family: Tahoma, sans-serif;
    direction: rtl;
    background-color: #f0f0f0;
    padding: 20px;
  }
  label, input, button {
    display: block;
    margin: 10px 0;
    font-size: 1.2em;
  }
  input {
    padding: 5px;
    width: 200px;
  }
  button {
    padding: 8px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    cursor: pointer;
  }
  button:hover {
    background-color: #0056b3;
  }
  #result {
    margin-top: 20px;
    font-weight: bold;
    font-size: 1.3em;
    color: #333;
  }
</style>
</head>
<body>
  <label for="nameInput">لطفا نام خود را وارد کنید:</label>
  <input type="text" id="nameInput" />

  <label for="ageInput">لطفا سن خود را وارد کنید:</label>
  <input type="number" id="ageInput" />

  <button onclick="createUsername()">ایجاد نام کاربری</button>

  <div id="result"></div>

<script>
  function createUsername() {
    const name = document.getElementById('nameInput').value.trim();
    const age = document.getElementById('ageInput').value.trim();
    if(name === '' || age === '') {
      document.getElementById('result').textContent = 'لطفا نام و سن را وارد کنید.';
      return;
    }
    const username = `${name}_${age}!`;
    document.getElementById('result').textContent = `نام کاربری پیشنهادی: "${username}"`;
  }
</script>
</body>
</html>
<< Previous page 1 2 Next page >>

Submit answer

Submitting answers is currently unavailable.

×
×
Close