Status: Not Started
  • scratchpad.py
  • Unit Test
Font Size
14
Parentheses autocomplete
Wrap lines
Editor
Theme
Code with blocks by default
Console Font Size
12
Console Theme
Display Server Graphics Screen
Show File Tab Bar
Debug Mode
Superhero Names
Unit Test
def generate_superhero_name(name, suffix):
return
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Output
Grading
Docs
Exercise
More
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Pass Test Message

Errors:

This student is viewing this assignment in English. View this page in English?

5 points

Create a function that generates a superhero name based on a given name.

The function should use the first three letters of the original name as the prefix for the superhero name combined with the suffix parameter. If the name has fewer than three letters, use the entire name as the prefix.

Parameters:

  • name (str): The original name from which to generate the superhero name.
  • suffix (str): The suffix to append to the prefix.

Example:

name = "Mark"
suffix = "man"
superhero_name = "Marman"

name = "Al"
suffix = "girl"
superhero_name = "Algirl"  # Using the full name as it has fewer than 3 letters
Python
Reset Code

Slides and Notes

No slides available for this video

About

Python 3 Practice
3.11.9 (default, Apr 6 2024, 17:59:24)
[GCC 6.4.0]